Hi,
Idiocy on my part, no doubt ... the intention is that the following simplistic demo script should output "Success" when run on perl 5.8.x, and output "Ok" when run on perl 5.00505:
use strict;
my $var = '';
if($] > 5.007) {
if(open (my $mem, '>', \$var)) {print "Success\n"}
}
else {print "Ok\n"}
It does as desired on perl 5.8.x, but fails to compile on 5.00505 (because there are too many arguments being supplied to
open).
I gather the best solution has something to do with string eval ... which I've never used (to any great effect, anyway). And the 'eval' documentation didn't produce any "Aaaaah, I see" moments for me. (Changing the
open call to a 2 argument form is not a viable solution :-)
Cheers,
Rob
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.