in reply to RE: MP3 server with IO::Socket
in thread MP3 server with IO::Socket
Thanks for your comments. I was surprised, but you seem to
be correct on the open statement. In the perlopentut
document the two different syntax's used are:
As for the print, you are also correct, but fortunately my logic still worked. print returns undef if it failed, but the logic still held because if you use the numeric operator '==' on undef it is equivalent to 0. So this code will work: print "hello\n" if undef == 0; But I modified the code as you suggested to be more explicit.
I did not realize that perl would parse 'or' and '||' differently.open FILE, "foo.txt" or die $!; #or open(FILE, "foo.txt") || die $!;
As for the print, you are also correct, but fortunately my logic still worked. print returns undef if it failed, but the logic still held because if you use the numeric operator '==' on undef it is equivalent to 0. So this code will work: print "hello\n" if undef == 0; But I modified the code as you suggested to be more explicit.
|
---|
In Section
Tutorials