diamondsandperls has asked for the wisdom of the Perl Monks concerning the following question:
#!C:/Perl/bin/perl.exe use strict; use warnings; my $ip_1 =~ m/(\d)-/g; $ip_1 = int($ip_1); my $ip_2 = $ip_1 - 1; my $input_file = 'CrystalReportViewer1.csv'; my $output_file = 'CrystalReportViewer2.csv'; open(my $output_fh, '>', $output_file) or die "Failed to open $output_file - $!"; open(my $input_fh, '<', $input_file) or die "Failed to open $input_file: $!"; while ( <$input_fh> ) { s/$ip_1/$ip_2/; print {$output_fh} $_; } close $output_fh;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: replacing the last portions of an octet
by blue_cowdawg (Monsignor) on Sep 18, 2012 at 19:40 UTC | |
by diamondsandperls (Beadle) on Sep 18, 2012 at 20:03 UTC | |
by diamondsandperls (Beadle) on Sep 18, 2012 at 20:06 UTC | |
|
Re: replacing the last portions of an octet
by atcroft (Abbot) on Sep 18, 2012 at 20:37 UTC | |
|
Re: replacing the last portions of an octet
by Kenosis (Priest) on Sep 18, 2012 at 20:14 UTC | |
|
Re: replacing the last portions of an octet
by AnomalousMonk (Archbishop) on Sep 19, 2012 at 02:27 UTC | |
|
Re: replacing the last portions of an octet
by ksublondie (Friar) on Sep 18, 2012 at 19:57 UTC | |
by diamondsandperls (Beadle) on Sep 18, 2012 at 20:00 UTC |