On Jun 30, John W. Krahn said: >Kevin Reid wrote: >> >> sub rotate { unshift @_, splice @_, shift @_; return @_ } > > >$ perl -le' >sub rotate { unshift @_, splice @_, shift @_; return @_ } >@x = qw/a b c d e f/; >print "@x"; >print "@{[rotate @x]}"; >' >a b c d e f >b c d e f > > >Doesn't shift() do pretty much the same thing? :-)
You shouldn't run perl with warnings, John. ;) The first arg to rotate() is the number of elements to rotate. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ]