Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Prepending to a file

by afoken (Chancellor)
on Oct 01, 2016 at 06:49 UTC ( [id://1173050]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Prepending to a file
in thread Prepending to a file

or die "Could not open file ", $file, ": $!";

Looks good. It seems you found a bug.

Because filenames may contain spaces and other "invisible" characters, especially when the code generating the filename has a bug (e.g missing chomp), you may want to quote it in the error message. And you could use string interpolation for the filename. So:

 or die "Could not open file '$file': $!";

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1173050]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-09-20 06:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (25 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.