WisDomSeeKer34 has asked for the wisdom of the Perl Monks concerning the following question:
After running it: perl counting.pl python.txt I get the following error:#!/usr/bin/perl use warnings; for ($x = 1; $x < 10; $x++) { if ($_ =~ /^\d/) {$y = $y + 1;} # if the line does start with a num +ber, ignore it. if ($_ != /^\d/) {print $y.$x;} # if the line doesn't start with nu +mber then print numbers. }
Purpose of the program is to line numbers according to chapter:
1.
1.1
1.2
2.
2.1
2.2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: numbering lines problem
by toolic (Bishop) on Nov 19, 2014 at 13:53 UTC | |
by WisDomSeeKer34 (Sexton) on Nov 19, 2014 at 14:30 UTC | |
|
Re: numbering lines problem
by AnomalousMonk (Archbishop) on Nov 19, 2014 at 14:25 UTC |