in reply to Re: multiple files to multiple files
in thread multiple files to multiple files

Although chomping input lines is often a good idea, I don't think it is necessary here, because the \s regex meta-character matches new line and carriage return characters:
DB<1> $line = "foo bar\n"; DB<2> print $line if $line !~ /^\s*$/; foo bar DB<3> $line = " \t \r \n"; DB<4> print $line if $line !~ /^\s*$/; DB<5>
Checking for the status of the open sys calls is the most urgent thing to do.

Replies are listed 'Best First'.
Re^3: multiple files to multiple files
by afoken (Chancellor) on Oct 18, 2015 at 09:41 UTC
    Checking for the status of the open sys calls is the most urgent thing to do.

    "autodie to the rescue!" ;-)

    Just add use autodie qw( open close ); to the script. It will replace the core open and close functions with wrappers that automatically check for errors.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
      Sure, it is another nice way of doing it, less boilerplate coding. ++

      Yet, I often prefer to check it manually myself because I can customize the error message to make more sense to the users of my programs, who can then often solve their issues (e.g. missing file) by themselves, rather than having to ask me for help or log an anomaly ticket.