On Thu, 2006-05-25 at 19:38 +0000, Saurabh Singhvi wrote: > Hi > > the format of split() defines that one > can split a string into a fixed number > of specifies strings. for eg > > ($login, $passwd, $remainder) = split(/:/, $_, 3); > > Now, the thing is, it splits on first 3 parts. > Can i do the reverse?? as in instead of the output > being the first 3 parts of split, the last 3 parts of > split for the same string.
I'm sure there is a cleaner way to write this, but try: ($gecos, $home, $shell) = ( split(/:/, $_) )[-3..-1]; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>