Earlier quoted context omitted.
I first looked at perl last week and also shared your sentiment. At first when I saw perl I was aghast. The "ugly" $%@ syntax seemed pointless and unreadable. Then I decided to take a look at a non-beginner book, Intermediate Perl http://it-ebooks.info/book/879/ . I was surprised and excited 50 pages in because I realized that Perl had a wealth of tricks , and that that "ugly" $%@ syntax actually had some cool reperc…
Unfortunately -- and this is one of the many "banana peels" in Perl 5 -- even a simple statement like print x if x > 5 is problematic in p5 for a whole bunch of reasons: (1) At a bare minimum, what you really need to say is: print "$x\n" if $x > 5; That extra "\n" is a definite turn-off to a lot of people when the get their very first look at Perl. Really, the default these days should be more "say"-like. Of course,…
Isn't it? If someone told you, really you to do just that, would you actually have a problem carrying out that command given a way to print something, a container, and a value to check against the container contents?
Also, here's me preference:
say $x if $x and $x > 5;
Need to catch zero? say $x if defined $x and $x == 0;