GiJoe has asked for the wisdom of the Perl Monks concerning the following question:
This is a continuation from Re^3: Text Massage.
What is the meaning of the following code?
Would you place # comments at the end of each line.
When I run the script, the output files are empty.
#!/usr/bin/perl -w use strict; $| =1; my $curve1_out = 'curve1.out'; my $curve2_out = 'curve2.out'; my $in ='curve12.data'; open (IN, '<', $in) or die "cannot open $in $!"; open (my $c1, '>', $curve1_out) or die "cannot open $curve1_out $!"; open (my $c2, '>', $curve2_out) or die "cannot open $curve2_out $!"; while (<IN>) { if (/^Curve(\d):/.../^\s*$/) { if (defined($1) && $1==1 && /^\d/) {print $c1 "$_\n";}; if (defined($1) && $1==2 && /^\d/) {print $c2 "$_\n"}; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: # Translation
by toolic (Bishop) on Apr 09, 2009 at 17:17 UTC | |
|
Re: # Translation
by jwkrahn (Abbot) on Apr 09, 2009 at 17:57 UTC | |
|
Re: # Translation
by bichonfrise74 (Vicar) on Apr 09, 2009 at 19:24 UTC | |
|
Re: # Translation
by JavaFan (Canon) on Apr 09, 2009 at 17:04 UTC | |
by GrandFather (Saint) on Apr 09, 2009 at 21:11 UTC | |
|
Re: # Translation
by codeacrobat (Chaplain) on Apr 10, 2009 at 06:42 UTC | |
|
Re: # Translation
by Anonymous Monk on Apr 10, 2009 at 06:09 UTC |