Skip to content

Instantly share code, notes, and snippets.

@jmblog
Created December 13, 2009 07:16
Show Gist options
  • Save jmblog/255328 to your computer and use it in GitHub Desktop.
Save jmblog/255328 to your computer and use it in GitHub Desktop.
モダンなファイル入出力
### file read ###
open my $fh, '<', $filename || die $@;
while (my $line = <$fh>) {
print $line;
}
close $fh;
### file write ###
use utf8;
open my $fh, ">:utf8", $filename or die $@;
print $fh "ほげほげ";
close $fh;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment