in reply to Default Line in Loops

# but have you tried this? foreach (sort <FILE>) { print; } while (sort <FILE>) { print; }

Replies are listed 'Best First'.
RE: RE: Default Line in Loops
by japhy (Canon) on Jan 10, 2000 at 19:46 UTC
    Personally, I'd do:
    print while <FH>;
    or even: print do { local($/), <FH> }; But think, for a moment, about:
    while (sort <FH>) { print; }
    You're now calling sort() in scalar context. It returns false, so that while() loop doesn't do jack. And I HIGHLY recommend against
    for (<FH>) { print; }
    Since that builds up a list of all the records in FH. -- japhy on EFnet, japh on DALnet, Jeff on Earth