Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Perl bug ?

by vsespb (Hermit)
on Feb 06, 2013 at 12:18 UTC ( #1017402=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Perl bug ?
in thread Perl bug ?

but anyway this

($errors && ($errors->[0] =~ /Journal file not found/i))
should be true only and only if $errors->[0] contains Journal file not found ?


Comment on Re^4: Perl bug ?
Download Code
Replies are listed 'Best First'.
Re^5: Perl bug ?
by choroba (Canon) on Feb 06, 2013 at 12:35 UTC
    Hmmm... strange. Can be simplified to
    perl -E 'my $e; say for $e && 0, $e->[0];'
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      seems like the arguments for "for" are executed first and then the loop body. so:
      the first element is $e && 0 which evaluates to $e. then the second argument is processed, autovivify happens.
      when in the loop body, $e is an array reference already, and because the first element is an alias to $e it prints ARRAY(0xde0d48). seems logical to me.

        Yes. B::Deparse shows the same interpretation:

        Q:\>perl -MO=Deparse -E "my $e; say for $e && 0, $e->[0];" BEGIN { $^H{'feature_unicode'} = q(1); $^H{'feature_say'} = q(1); $^H{'feature_state'} = q(1); $^H{'feature_switch'} = q(1); } my $e; ; say $_ foreach ($e && 0, $$e[0]); -e syntax OK

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017402]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2015-07-28 07:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (252 votes), past polls