From: Philip Newton Date: Sat, 16 Feb 2002 10:05:05 +0000 (+0100) Subject: [DOC PATCH perlport.pod] Typo fix and three-arg open X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe8296896b14aa93f1136ce57f05259d511ec956;p=p5sagit%2Fp5-mst-13.2.git [DOC PATCH perlport.pod] Typo fix and three-arg open Message-Id: <558s6u4djrbk46q44fvqs5mfviq9311lj1@4ax.com> (Applied by hand.) p4raw-link: @4 on //depot/thrperl: 11343788cbaaede18e3146b5219d2fbdaeaf516e p4raw-id: //depot/perl@14718 --- diff --git a/pod/perlport.pod b/pod/perlport.pod index df30415..0fa8d26 100644 --- a/pod/perlport.pod +++ b/pod/perlport.pod @@ -332,20 +332,23 @@ first 8 characters. Whitespace in filenames is tolerated on most systems, but not all, and even on systems where it might be tolerated, some utilities -might becoem confused by such whitespace. +might become confused by such whitespace. Many systems (DOS, VMS) cannot have more than one C<.> in their filenames. Don't assume C<< > >> won't be the first character of a filename. -Always use C<< < >> explicitly to open a file for reading, -unless you want the user to be able to specify a pipe open. +Always use C<< < >> explicitly to open a file for reading, or even +better, use the three-arg version of open, unless you want the user to +be able to specify a pipe open. - open(FILE, "< $existing_file") or die $!; + open(FILE, '<', $existing_file) or die $!; If filenames might use strange characters, it is safest to open it with C instead of C. C is magic and can translate characters like C<< > >>, C<< < >>, and C<|>, which may be the wrong thing to do. (Sometimes, though, it's the right thing.) +Three-arg open can also help protect against this translation in cases +where it is undesirable. Don't use C<:> as a part of a filename since many systems use that for their own semantics (MacOS Classic for separating pathname components,