Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: Dereference string in foreach

by LanX (Canon)
on Feb 14, 2013 at 22:12 UTC ( #1018806=note: print w/ replies, xml ) Need Help??


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

> 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


Comment on Re^4: Dereference string in foreach
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2014-07-31 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (251 votes), past polls