Skip to content

Instantly share code, notes, and snippets.

@taiyoh
Created December 24, 2010 10:39
Show Gist options
  • Save taiyoh/754099 to your computer and use it in GitHub Desktop.
Save taiyoh/754099 to your computer and use it in GitHub Desktop.
modify file with no module
#!perl -w
use strict;
use utf8;
open my $f, '<', 'a.txt';
flock($f, 2);
my $data = <$f>;
chomp $data;
open $f, '+>', 'a.txt';
print $f 'abc';
close $f;
__DATA__
@a.txt
abcde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment