kalyanrajsista has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to assign single quotes to array elements with the following code, but is not doing what I wanted. Is map() suggestible or any other way to do it
use strict; my @foo = ('usa', 'cananda', 'strawberry'); @foo = map { "'$_',", @foo); print @foo; # printing as 'usa','cananda','strawberry', # instead of 'usa','cananda','strawberry'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: map array elements with single quotes
by ikegami (Patriarch) on Mar 10, 2010 at 07:24 UTC | |
| |
|
Re: map array elements with single quotes
by AnomalousMonk (Archbishop) on Mar 10, 2010 at 18:55 UTC |