Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
We don't bite newbies here... much
 
PerlMonks  

Re^3: File Input and Output

by apotheon (Deacon)
on Oct 16, 2004 at 07:49 UTC ( #399738=note: print w/ replies, xml ) Need Help??


in reply to Re: RE: File Input and Output
in thread File Input and Output

It occurs to me that this fact might not be intuitively obvious to someone that isn't already used to that behavior, as for instance from regular use of bash. It's intuitively obvious to me, but I'm a penguinista. Those who write Perl but use Windows, for instance, wouldn't be used to that kind of behavior. Remember that in the Windows GUI environment files never get named until they're saved after editing. Habitual Windows users probably never realize that what's going on is that the file is actually only being "opened" for the first time when that "okay" button in the save dialog is clicked.

So: For those of us used to that sort of behavior (like 'nix users), it's "Of course it will create a new file." For those who are not (like Windows users), it's "Oh. That's news to me."

The fact that one must use >> instead of > to edit an already extant file without wiping out its contents is an important fact, though, and it's a good thing you brought it up. It should really be included in the text of the tutorial itself.

- apotheon

CopyWrite Chad Perrin


Comment on Re^3: File Input and Output
Re^4: File Input and Output
by mr_mischief (Prior) on Oct 05, 2007 at 21:02 UTC
    Sorry it took me three years to make this note, but people who've used DOS or the Windows command line and worked with redirection have used the same > and >> that bash uses. It's just the GUI-only folks who wouldn't know this.

      True . . . and I could have been more clear about that. Most MS Windows users (these days) are basically GUI-only types, though.

      print substr("Just another Perl hacker", 0, -2);
      - apotheon
      CopyWrite Chad Perrin

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-04-18 07:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (463 votes), past polls