in reply to sorting text arrays and ignoring case

A few other ways of writing out the contents of the array:

print "@items\n"; print join ('\n', @items), "\n"; print "$_\n" for @items;

DWIM is Perl's answer to Gödel

Replies are listed 'Best First'.
Re^2: sorting text arrays and ignoring case
by johngg (Canon) on Mar 10, 2006 at 09:20 UTC
    Or how about

    { local $" = "\n"; print "@items\n"; }

    to get one item per line?

    Cheers,

    JohnGG

      Nope, all in a line with spaces between items. But a trick worth knowing.

      Update: the node I replied to seems to have completely chenged its contents. My reply is no longer relevant.


      DWIM is Perl's answer to Gödel
        Strange. Works on my system in many different scripts. Oh well! I use a similar technique when looking for members of a list as alternation in regular expressions.

        { local $" = "|"; $rxMatch = qr{blahblah(@members)morestuff}; }

        Cheers

        Johngg