in reply to Comparing $_ --- before/after
you could use the diff command:
use strict; use warnings; my $file = "file"; open( FILE, "<", $file) or die "$!\n"; $_ = do { local $/; <FILE> }; close(FILE); s/match/replace/gi; s/match1/replace1/gi; open(my $new_file,'>','new_file')or die "$!\n"; print $new_file $_; close $new_file or die "$!\n"; print `diff $file new_file`;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Comparing $_ --- before/after
by mrc (Sexton) on Oct 10, 2009 at 10:17 UTC |