Another excellent tool (if you don't mind a tron of output) is
use diagnostics -verbose;
enable diagnostics;
Paul
--- ktb <[EMAIL PROTECTED]> wrote:
> On Sat, Feb 15, 2003 at 01:03:50PM -0800, brady jacksan wrote:
> > Hi
> >
> > I am writing a script that reads file from command line and
> places
> > each line from the files into an array, and prints out the total
> lines
> > read and then
> > each line read.
> >
> > while (defined ($files = <>)) {
> > chomp;
> > print "Total lines in the files:@files\."
> > print "@files\n"
> >
> > why do keep getting compilation errors?
>
> You don't have a semicolon at the end of your first print statement
> and
> there is now closing brace.
>
> To better help diagnose your code use:
> use strict;
> use warnings;
>
> Also take a look at how you're reading in your file.
>
> The following code could be used to do the same thing. I've added
> comments for clarity in case any of it is new to you -
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> my $count = 1; # set $count to one before starting.
> while (<>) { # use diamond operator to slurp in lines of
> file.
> next if /^\s+$/; # skip lines containing spaces from start to
> finish.
> print "$count $_"; # print current count and line from file.
> $count++; # autoincrement $count for each line.
> }
>
> hth,
> kent
>
> --
> To know the truth is to distort the Universe.
> Alfred N. Whitehead (adaptation)
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]