in reply to How do I modify a line within the file itself?
So Path::Tiny it like autodies for you :)
#!/usr/bin/perl -- use strict; use warnings; use Path::Tiny; my( $inFile, $outFile ) = @ARGV; my $outfh = path( $outFile )->openw_raw; my $infh = path( $infile )->openr_raw; while( my $line = <$infh>){ chomp $line; if ($line =~ /\>/) { my @modify_line = split(/\s/,$line); $line = $modify_line[0]; } print $outfh "$line\n"; } close $infh; close $outfh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do I modify a line within the file itself?
by 1nickt (Canon) on Jul 09, 2015 at 02:18 UTC | |
by Anonymous Monk on Jul 09, 2015 at 03:31 UTC | |
by 1nickt (Canon) on Jul 09, 2015 at 10:26 UTC |