Greetings, Thanks Timothy for emphasising the importance of brackets. best, Shaji ------------------------------------------------------------------------------- Your talent is God's gift to you. What you do with it is your gift back to God. -------------------------------------------------------------------------------
________________________________ From: timothy adigun <2teezp...@gmail.com> To: *Shaji Kalidasan* <shajiin...@yahoo.com> Cc: Perl Beginners <beginners@perl.org> 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 Kalidasan* <shajiin...@yahoo.com> 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 '[', join '][', @fruits; >#print ']'; > > >print '[', join '][', @fruits, ']'; print '[', ( join '][', @fruits ), ']'; Please note the placement of the brackets. best, >[/code] > > >[output] >[apple][mango][orange][banana][guava][] > >[/output] > > > >How can I make the output to eliminate the last empty square brackets [] using >a single print statement. I used two print statements as shown in the code >snippet above (#lines are commented out) > > >Any help is greatly appreciated. > > >best, >Shaji >------------------------------------------------------------------------------- >Your talent is God's gift to you. What you do with it is your gift back to God. >------------------------------------------------------------------------------- -- Tim