in reply to cut of first char of a string

Well, here's a couple of simple ones:

print join'',@{[do{shift@{$s=[split//,$s='foobarbaz']};@$s}]} print $s=reverse@{$s=do{pop @{$s=[split//,reverse$s='foobarbaz']};$s}}
Although, I'm honestly not sure why the $s= that immediately precedes the do is necessary in the second one. Can anyone explain it to me?

Replies are listed 'Best First'.
Re^2: cut of first char of a string
by ambrus (Abbot) on Jul 04, 2005 at 08:47 UTC
    I'm not sure but I think it's needed because you assign an anonymous array to $s before it, so if you do not set $s, the rightmost $s will give that array.