Skip to content

Instantly share code, notes, and snippets.

@riywo
Created January 31, 2013 00:12
Show Gist options
  • Save riywo/4678650 to your computer and use it in GitHub Desktop.
Save riywo/4678650 to your computer and use it in GitHub Desktop.
Open a file with read and write mode or create the file if it does not exist in Perl
$ ls
$ perl -e 'open my $fh, "+<", "hoge" or die $!'
No such file or directory at -e line 1.
$ ls
$ perl -MFcntl -e 'sysopen my $fh, "hoge", O_RDWR|O_CREAT or die $!'
$ ls
hoge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment