Re: using join

2013-08-04 Thread Uri Guttman
On 08/04/2013 03:16 PM, Peter Gordon 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 j

Re: using join

2013-08-04 Thread Michael Rasmussen
On Sun, Aug 04, 2013 at 12:59:29PM +0800, *Shaji Kalidasan* wrote: > Greetings, > > I am facing some difficulty using join to display the array elements > > Here is the code snippet > > [code] > use strict; > use warnings; > > my @fruits = qw/apple mango orange banana guava/; > > print '[', jo

Re: using join

2013-08-04 Thread Shawn H Corey
On Sun, 4 Aug 2013 12:59:29 +0800 (SGT) *Shaji Kalidasan* wrote: > I am facing some difficulty using join to display the array elements > > Here is the code snippet > > [code] > use strict; > use warnings; > > my @fruits = qw/apple mango orange banana guava/; > > #print '[', join '][', @fruit

Re: using join

2013-08-04 Thread Peter Gordon
On Sun, 4 Aug 2013 10:40:47 +0100, timothy adigun wrote: > See the usage of "join", `perldoc -f join`,  what you wanted is >    my $str = join '', map "[$_]", @fruits; > say $str; Thanks Timothy, It was only after I copied join '', map "[$_]", @fruits; to the clipboard & entered it in a text editor

Re: using join

2013-08-04 Thread timothy adigun
Hi Peter, On Sun, Aug 4, 2013 at 8:16 PM, Peter Gordon 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 p

Re: using join

2013-08-04 Thread Shlomi Fish
Hi Peter, On Sun, 4 Aug 2013 19:16:32 GMT Peter Gordon 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 p

Re: using join

2013-08-04 Thread Peter Gordon
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 pu

Re: using join

2013-08-03 Thread timothy adigun
Uri, On Sun, Aug 4, 2013 at 6:58 AM, Uri Guttman wrote: > On 08/04/2013 01:44 AM, timothy adigun wrote: > > >> OR some like to write it like so: >> { >> local $" = ']['; >> print '[', "@fruits", ']'; >> } >> > > that is a poor idea. setting $" isn't needed to do a simple join. > Yes I agre

Re: using join

2013-08-03 Thread Uri Guttman
On 08/04/2013 01:44 AM, timothy adigun wrote: OR some like to write it like so: { local $" = ']['; print '[', "@fruits", ']'; } that is a poor idea. setting $" isn't needed to do a simple join. but what no one has said is a more direct way to do this. you need map and join but it is muc

Re: using join

2013-08-03 Thread timothy adigun
On Sun, Aug 4, 2013 at 6:28 AM, timothy adigun <2teezp...@gmail.com> wrote: > > Hi, > You want to read: > > On Sun, Aug 4, 2013 at 5:59 AM, *Shaji Kalidasan* wrote: > >> Greetings, >> >> I am facing some difficulty using join to display the array elements >> >> Here is the code snippet >> >> [code

Re: using join

2013-08-03 Thread *Shaji Kalidasan*
o God. --- From: timothy adigun <2teezp...@gmail.com> To: *Shaji Kalidasan* Cc: Perl Beginners Sent: Sunday, 4 August 2013 10:58 AM Subject: Re: using join Hi, You want to read: On Sun, Aug 4, 2013 at 5:59 AM, *Shaji Kalida

Re: using join

2013-08-03 Thread *Shaji Kalidasan*
o God. --- From: Michael Rasmussen To: *Shaji Kalidasan* Cc: Perl Beginners Sent: Sunday, 4 August 2013 10:37 AM Subject: Re: using join On Sun, Aug 04, 2013 at 12:59:29PM +0800, *Shaji Kalidasan* wrote: > Greetings, > > I am facing s

Re: using join

2013-08-03 Thread timothy adigun
Hi, You want to read: On Sun, Aug 4, 2013 at 5:59 AM, *Shaji Kalidasan* wrote: > Greetings, > > I am facing some difficulty using join to display the array elements > > Here is the code snippet > > [code] > use strict; > use warnings; > > my @fruits = qw/apple mango orange banana guava/; > > #pri