I am just reading and testing the 5.10 features of perl. Tested "say", "state" but it works only when 'use v5.10' is there in file. Why it is ?
perl version available by default in my machine is
perl -v
This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License
+ or the GNU General Public License, which may be found in the Perl 5
+source kit.
Complete documentation for Perl, including FAQ lists, should be found
+on this system using "man perl" or "perldoc perl". If you have acces
+s to the Internet, point your browser at http://www.perl.org/, the Pe
+rl Home Page.
without version requirement
perl -e 'say "test"';
String found where operator expected at -e line 1, near "say "test""
(Do you need to predeclare say?)
syntax error at -e line 1, near "say "test""
Execution of -e aborted due to compilation errors.
with version requirement it works fine
perl -M5.10.1 -e 'say "test"';
test
Is it my misunderstanding, please explain me. Google search with these words 'say', 'state', are not giving useful results. Thanks for your help.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.