Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • …with strict and warnings enabled?
    --
    Ordinary morality is for ordinary people. -- Aleister Crowley
  • You have two different $foo variables in there. Is that the actual code you're trying to use?

    If the package version of $foo has a value, that's what the lexical version of $foo gets in the assignment:

    $foo = 'Hello'; # package version
     
    print(  my $foo = bar() ? $foo : "unknown" );
     
    print "foo is [$foo]";
     
    sub bar { 1 };