xorl has asked for the wisdom of the Perl Monks concerning the following question:
The output I want is:my @bar = qw(One Two Three); my $foo = "bar"; print "***" . $foo . "***\n"; foreach my $baz (@$foo) { print $_ . "\n"; }
***bar*** One Two ThreeNow I tried $foo = \@bar, but I got the expected Array reference stuff when I printed it. Is there any easy way to keep $foo as a string and still be able to use to access the array or if I make $foo the array reference is there an easy way to get the sting bar from it? I'm also using v5.6.1 built for MSWin32-x86-multi-thread if that makes any difference. Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create an array reference from a string
by Corion (Patriarch) on Apr 12, 2004 at 19:28 UTC | |
by xorl (Deacon) on Apr 12, 2004 at 19:37 UTC | |
by dragonchild (Archbishop) on Apr 12, 2004 at 19:44 UTC | |
|
Re: Create an array reference from a string
by jdporter (Paladin) on Apr 12, 2004 at 19:32 UTC | |
|
Re: Create an array reference from a string
by dragonchild (Archbishop) on Apr 12, 2004 at 19:26 UTC | |
by xorl (Deacon) on Apr 12, 2004 at 19:29 UTC | |
|
Re: Create an array reference from a string
by Ovid (Cardinal) on Apr 12, 2004 at 19:47 UTC | |
by xorl (Deacon) on Apr 13, 2004 at 13:16 UTC | |
|
Re: Create an array reference from a string
by boby_drack (Acolyte) on Apr 12, 2004 at 20:48 UTC | |
|
Re: Create an array reference from a string
by Sandy (Curate) on Apr 14, 2004 at 23:31 UTC |