At 02:52 PM 5/20/02 -0700, drieux wrote:
>What may help the process here is to think 'cat' but in 'perl'
>
> #!/usr/bin/perl -w
> use strict;
>
> foreach my $file (@ARGV) { # for everything we see on the command
> line
> # let us
> assume it is a file for simplicity
> if ( -f $file ) {
> open(FH, "$file"); # normally we want to die
> print $_ while(<FH>); # silly but a one liner
> # could
> have been while(<FH>) { print $_ ;}
> # but
> that always makes me think that the
> # code is
> winking at me...
> close(FH);
> }else{
> print "cat: $file: No such file or directory\n";
> }
> }
I missed the earlier articles in the thread so may be off base wrt original
question here, but the above is usually written as:
print while <>;
--
Peter Scott
Pacific Systems Design Technologies Boston Perl Classes in July:
http://www.perldebugged.com/ http://stemsystems.com/class/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]