![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: how to split a string and take certain position?by mreece (Friar) |
on Sep 24, 2007 at 04:26 UTC ( #640653=note: print w/replies, xml ) | Need Help?? |
sure, if you group your parens appropriately -- (split)[$i]: print( (split(/:/, $sentence))[1] ); # negative indexes work too or the less cluttered: print +(split /:/, $sentence)[1]; for the latter question, consider: ($match) = $sentence =~ /([^:]+)$/
In Section
Seekers of Perl Wisdom
|
|