in reply to grep in list context behaves as scalar context

i have 2 identical Linux boxes.

Maybe you do or maybe they are not actually identical after all. Anyway, to avoid contamination by anything else going on in your script try running this one-liner on both boxes.

perl -e '($z) = grep (/b/, "foo", "bar"); print "z is $z\n";'

If box 2 says "z is 1" instead of "z is bar" then start comparing things between the two boxes: perl versions, environment vars, shell versions, etc.

Replies are listed 'Best First'.
Re^2: grep in list context behaves as scalar context
by pedrete (Sexton) on Jun 17, 2015 at 22:41 UTC
    Thanks a lot hippo!! your one-liner showed same results on both boxes... so something else is contaminating my script, blood and soul... Thanks again! Pedrete.