From: Sherm Pendley on
"John" <john1949(a)yahoo.com> writes:

> I've changed
> use Socket;
> to
> require Socket;
>
> in a subroutine since I use it infrequently
>
> I'm getting the error message
>
> Bareword "AF_INET" not allowed while "strict subs"
>
> What have I done?

You changed "use" to "require". They don't do the same thing; more to
the point, the latter does not call "import," which is why the AF_INET
symbol didn't get imported into your name space.

For details, have a look at the docs for the functions you're using:

perldoc -f use
perldoc -f require

sherm--
From: Mumia W. on
On 01/14/2010 08:25 AM, John wrote:
> "J�rgen Exner" <jurgenex(a)hotmail.com> wrote in message
> news:1v8uk51i808hfbe9f7h9atf577fa98eokn(a)4ax.com...
>> "John" <john1949(a)yahoo.com> wrote:
>>> I've changed
>>> use Socket;
>>> to
>>> require Socket;
>>>
>>> in a subroutine since I use it infrequently
>>>
>>> I'm getting the error message
>>>
>>> Bareword "AF_INET" not allowed while "strict subs"
>>>
>>> What have I done?
>> Isn't that obvious? You changed
>> use Socket;
>> to
>> require Socket;
>> ;-))
>>
>> Seriously, you are missing the import() part of use(), see
>> perldoc -f use
>>
>> jue
>
> I've added Socket->import(); but same error - John
>
>
>

Treat AF_INET as a function--which it is: AF_INET().

Or you can place a forward declaration near the top of your program:

sub AF_INET;