Hi Peter,

On Sun, Aug 4, 2013 at 8:16 PM, Peter Gordon <pete...@netspace.net.au>wrote:

> On Sun, 4 Aug 2013 07:10:59 +0100, timothy adigun wrote:
> >my @fruits = qw( apple pear banana ) ;
> >print join '', map "[$_]", @fruits ;
> >
> >now you can see each element surrounded by [] and then joined into
> >one string for printing.
> >
> >you don't even need the join if you are just printing it but i put
> >it there so you can use the same concept if you are going to
> >save the string.
>
> my $str = join  (map "[$_]", @fruits);
>

   See the usage of "join", `perldoc -f join`,  what you wanted is

    my $str = join '', map "[$_]", @fruits;


> say $str;
>
> This code outputs a blank line & I can't see how to produce
> a string of the required output using join & map.  Anybody
> have an answer?
> Thanks
>
> --
> Peter Gordon, pete...@netspace.net.au on 08/04/2013
>
>
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>


-- 
Tim

Reply via email to