--- Steffen Mueller <[EMAIL PROTECTED]> wrote: > [ > Crossposted to perl.fwp and perl.golf. Reply to set to perl.golf. > Hope the > newsreader won't fsck it up. :) > ] > > "Aaron J Mackey" <[EMAIL PROTECTED]> schrieb... > > > I can't seem to get this any shorter: I want the second through > the > > next-to-last elements of @F joined by " ", and then the last item > of @F. > > > > perl -ape '$,=" ";s//>@F[1..$#F-1]\n$F[$#F]/' > > > > or (no join, but same general idea): > > > > perl -pe 's/\s+(\S+)$/\n$1/;s/^\S+\s+/>/;' > > perl -ae 'print"@F[1..$#F-1] > $F[$#F]"' > > To be honest, I haven't tested this, but it looks like it should > work just > fine. IIRC, "@ary" will be interpolated to "" > > Of course, I regularily miss obvious things. This should give you > some > ideas, though.
Why not replace the last but one element with a \n? Phil ===== -- "One cannot delete the Web browser from KDE without losing the ability to manage files on the user's own hard disk." - Prof. Stuart E Madnick, MIT. So called "expert" witness for Microsoft. 2002/05/02 __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com