Perl: why $scalar += 0;
Hello :)
I am dabbling in Perl like a tiny cygnet adrift on a windy river. Here's the code: Code:
my $pop = Net::POP3->new("poczta",Timeout=>30)# conect to mail BTW I've netsearched for Perl intros/tutorials and found a gazillion. Are there any which are particularly recommended? A Perl cribsheet/reference would be handy too. Best Charles |
Hi.
I don't know what login returns, but it might be something like an empty (visually) string. An example: Code:
#!/usr/bin/env perl Code:
% ./p1 Try printing $messages before the arithmetic operation. I use books, but if I run across a cheat-sheet, I'll post the link ... cheers, makyo |
Thanks makyo :) Hole in one! Nice illustration. From http://search.cpan.org/~gbarr/libnet-1.19/Net/POP3.pm:
Code:
login ( [ USER [, PASS ]] ) |
Hi, catkin.
I tried a lot of return values; it depends on how they do it: Code:
#!/usr/bin/env perl Code:
% ./p6 |
Quote:
Code:
#!/usr/bin/perl Code:
0E0 |
To clarify, as I should have said in the previous post:
|
Hello together,
Quote:
It is not only an excellent tutorial for Perl but also covers a wide variety of Unix/Linux in a whole. It is very well written, and readable. You know Larry Wall, the creator of Perl is a linguist as well as an excellent adept of Unix. Since Perl has it's origin in the Unix-world and bases on many of the standard Unix-tools like e.g. sed, grep and the various shells, this book covers far more than only the Perl-language. In my opinion it belongs to a handful of "must have read" books about Unix/Linux (where the other very important book is "Regular Expression" of Jeffrey Friedl). Markus |
Quote:
Anyway, from the documentation: Code:
login ( [ USER [, PASS ]] ) Code:
$messages += 0; Code:
perldoc -otk -t -q scalar number Code:
There are also some commonly used modules for the task. Scalar::Util |
Hi.
Quote:
Best wishes ... cheers, makyo |
Regarding books - probably http://perldoc.perl.org/ -> Reference, http://perldoc.perl.org/index-tutorials.html .
|
Quote:
on O'Reilly's website... :} Just one note on that: Perl 5.004 is 14 years old, things have evolved a fair bit since. |
Hi, Tinkster.
Quote:
I had not thought about that. The Guide author's page is at http://www.vromans.org/johan/perlref.html pointing to http://www.squirrel.nl/pub/perlref-5.004.1.pdf so I think the 31-page pdf is OK. There are also links to text and HTML versions. I agree that Perl has moved ahead, and I have not looked at the Guide in detail. The edition of Programming perl book that I use is from 2000 (3rd edition). There is a long history of editions for the Guide. The 4th Edition available from O'Reilly has 96 printed pages. My take is that the basic stuff is pretty much the same. Some of the perl 6 functionality has been made available in modules, e.g. http://search.cpan.org/~jesse/perl-5...lib/feature.pm I have attended local conferences, for example one coming up is http://www.frozen-perl.org/mpw2011/ , and implementations of perl 6 still seems likely to be in development for a while. cheers, makyo |
Quote:
|
Quote:
|
Quote:
EDIT: concerns about it being back-level noted; will see how it works out in practice, cross-referencing other sources as necessary (and will try to remember to update this thread if findings are significant). |
All times are GMT -5. The time now is 03:44 AM. |