G
gg500
Hello,
Few things puzzles me in perl. I'm trying to use warnings and strict
and run with perl -w, but I get warnings which I do not understand. For
example I have to use "use Fcntl qwDEFAULT :seek);" in order to get
no warnings using SEEK_SET etc, this phrase I copied got from net while
not understanding what it means. Could you describe this statement?
Is there some other useful things which I can set to make warnings as
explanatory and abundant as possible? I mean something equal to gcc
-Wall -pedantic.
If I write "split /\./, $ENV(REMOTE_ADDR)" I get warning about using
undefined variable, so without knowing how exactly I should proceed I
have written abundant amount of lines like "defined $ENV{REMOTE_ADDR} ?
$ENV{REMOTE_ADDR} : """. Obviously I do not understand the
fundamentals, so could you please explain what I do wrong since I get
myself into this situation?
It must have taken me 10 hours to try to get information how to refer
single byte (char) in "string/array", like in C: char a[5]; return
a[2]; without realizing that's not how things are done in perl. Is this
correct? So if I'm to do something with chars in string (or perl
variable that is) I am to split the variable to @array first? Does this
not impose performance problems in general?
I'm also a bit confused with calling functions or "sub routines".
Writing "&subroutine();" works but I do not understand what exactly is
the difference when omitting "()" and/or "&"...?
Also do I need to flock UN_LOCK before closing the file, or does close
handle the unlocking automatically?
Few things puzzles me in perl. I'm trying to use warnings and strict
and run with perl -w, but I get warnings which I do not understand. For
example I have to use "use Fcntl qwDEFAULT :seek);" in order to get
no warnings using SEEK_SET etc, this phrase I copied got from net while
not understanding what it means. Could you describe this statement?
Is there some other useful things which I can set to make warnings as
explanatory and abundant as possible? I mean something equal to gcc
-Wall -pedantic.
If I write "split /\./, $ENV(REMOTE_ADDR)" I get warning about using
undefined variable, so without knowing how exactly I should proceed I
have written abundant amount of lines like "defined $ENV{REMOTE_ADDR} ?
$ENV{REMOTE_ADDR} : """. Obviously I do not understand the
fundamentals, so could you please explain what I do wrong since I get
myself into this situation?
It must have taken me 10 hours to try to get information how to refer
single byte (char) in "string/array", like in C: char a[5]; return
a[2]; without realizing that's not how things are done in perl. Is this
correct? So if I'm to do something with chars in string (or perl
variable that is) I am to split the variable to @array first? Does this
not impose performance problems in general?
I'm also a bit confused with calling functions or "sub routines".
Writing "&subroutine();" works but I do not understand what exactly is
the difference when omitting "()" and/or "&"...?
Also do I need to flock UN_LOCK before closing the file, or does close
handle the unlocking automatically?