Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^3: Dereference string in foreach

by blue_cowdawg (Monsignor)
on Feb 14, 2013 at 15:30 UTC ( #1018744=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Dereference string in foreach
in thread Dereference string in foreach

      You don't need to be an utter cowdawg towards the OP -- strict and warnings are irrelevant to his issue.

I wasn't being mean, ornery or cantankerous. Take what I said at face value. If strict and warnings were turned on (as I showed) the problem would have shown itself very clearly.


Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg


Comment on Re^3: Dereference string in foreach
Re^4: Dereference string in foreach
by Anonymous Monk on Feb 14, 2013 at 19:29 UTC

    Oh. I seem to have missed the part where the problem showed itself very clearly. I'm still not quite sure where it is shown, actually.

Re^4: Dereference string in foreach
by Anonymous Monk on Feb 14, 2013 at 21:34 UTC

    Anyway, sorry about that. I did not particularly mean to lash out at you -- your advice just seemed like one of those "you must use strict even for the smallest script" posts that I sometimes see.

Re^4: Dereference string in foreach
by LanX (Canon) on Feb 14, 2013 at 22:12 UTC
    > If strict and warnings were turned on (as I showed) the problem would have shown itself very clearly.

    Nope, it's another problem just at the same place.

    Using my fixes the errors but not the OP's problem, which is foreach localization and aliasing.

    use warnings; use strict; my $string; my @array_of_strings=1..3; my $sref = \$string; foreach $string ( @array_of_strings ) { print $$sref; } __END__ Use of uninitialized value in print at - line 8. Use of uninitialized value in print at - line 8. Use of uninitialized value in print at - line 8. lanx@nc10-ubuntu:~$

    Cheers Rolf

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-10-24 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (137 votes), past polls