On Sat, May 14, 2011 at 1:37 PM, Brandon McCaig <bamcc...@gmail.com> wrote: > On Sat, May 14, 2011 at 3:57 AM, Agnello George > <agnello.dso...@gmail.com> wrote: >> I got a string like this >> >> $string = ' [a b c d]' >> >> i need to get a b c d in to a array called @all. >> >> i was was trying to so a split with delimiter '\s+' but still i get >> >> [a >> b >> c >> d] >> >> but i want >> >> a >> b >> c >> d >> >> >> any idea how to get this done , thanks > > TIMTOWTDI. There is more than one way to do it. The question first > becomes how specific is the string. Do you only want to know how to do > it with your example string or is the actual string somewhat variable? > For example: > > use strict; > use warnings; > > use Data::Dumper; > > my $string = '[a b c d]'; > > my @results = $string =~ /(\w)/g; > > print Dumper \@results; > > Match a single word-character and capture it; do this globally > throughout the string, and store all of the captured results in an > array. > > -- > Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com> > V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. > Castopulence Software <http://www.castopulence.org/> > <bamcc...@castopulence.org> >
thanks that worked !! -- Regards Agnello D'souza -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/