in reply to Help Sorting a CSV File

This almost works but it includes my first record

Notwithstanding 1nickt's excellent advice (which you should heed) there's a trivial adjustment to your script which should do what you want. Just read and print the first line before you sort the rest.

print $fDest <$fSource>;

Untested* but simple enough that hopefully the gist is obvious. BTW, it will help your cause for future posts if you wrap your code in <code> ... </code> tags as I have done here.

*Update: As AnomalousMonk has pointed out below (++) you'll need to enforce scalar context here.

Replies are listed 'Best First'.
Re^2: Help Sorting a CSV File
by AnomalousMonk (Archbishop) on Oct 04, 2019 at 15:44 UTC
    print $fDest <$fSource>;

    Reading from  <> (see readline) in the list context imposed by the argument list of print will read all lines from the filehandle. For reading just one line, use something like:
        print $fDest scalar <$fSource>;
    to impose scalar context (see scalar).


    Give a man a fish:  <%-{-{-{-<