in reply to Re: Re: Re: Perlish way to do an ls *.sf
in thread Perlish way to do an ls *.sf

but wouldn't you rather...
print join $/, <*.$ext>;
   MeowChow                                   
               s aamecha.s a..a\u$&owag.print

Replies are listed 'Best First'.
Re: (MeowChow) Re4: Perlish way to do an ls *.sf
by Juerd (Abbot) on Mar 30, 2002 at 00:31 UTC

    print join $/, <*.$ext>;

    print map$_.$/,<*.$ext>;
    Same length, but also adds newline to last item.

    U28geW91IGNhbiBhbGwgcm90MTMgY
    W5kIHBhY2soKS4gQnV0IGRvIHlvdS
    ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
    geW91IHNlZSBpdD8gIC0tIEp1ZXJk
    

      I wasn't really making a golf point, just trying to simplify. No need to mess with localized perlvars just for newline.

      For golf, you can take out the spaces:

      print join$/,<*.$ext>;
      If you want really that final newline, we can still cut out two chars from your last one:
      print$_.$/for<*.$ext>;
      and of course remove the trailing semicolons :)
         MeowChow                                   
                     s aamecha.s a..a\u$&owag.print

      I'd rather:

      print join $/,<*$ext>,'';

      Avoiding concatenation and adding a newline to the last item.