You are missing the point,
I may have mis-type the code on the message, but it works. The problem is the regxp. This line


if($_ =~ /tgz$/) { print "$_\n";};
That's is all I am asking....



Aaron J. Seigo wrote:

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On February 20, 2004 03:40, Juan Alberto Cirez wrote:


Maybe I've had too much medication, but as far as I can tell this piece
of code if supossed to read a file and spit out all the *.tgz lines it
enounters:

#!/usr/bin/perl
$LOCATION=$ARGV[0];



this will be first thing on the command line. Perl doesn't work like C, AFAIK, in that it doesn't put the command's name in ARGV[0].




$FILENAME=ARGV[1];



$ARGV not ARGV ...




open(FILE, $FILENAME) || die "Error: Cannot open $FILENAME. Aborting...\n";
while(<FILE>) {
chomp;
if($_ =~ /tgz$/) {
print "$_\n";
};
};
close FILE;
print "Done proccessing $FILENAME...\n";



the rest looks fine.




I mean, there is no way there is something wrong with this, is there...?



besides the above errors, i'd question using Perl as a teaching language =) Python might be a cleaner option.




I am trying to teach my kid the art of coding....



cool =)


- -- Aaron J. Seigo
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
while (!horse()); cart();
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)


iD8DBQFANpGD1rcusafx20MRArIaAJ9r7Tj2KiuFb9/yrBKRrCtO5TwXeQCfVjdw
8kPLBvqzwlCDSTTLpJsvcIU=
=TIza
-----END PGP SIGNATURE-----

_______________________________________________
clug-talk mailing list
[EMAIL PROTECTED]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca




-- =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= --oo0oo-- Juan Alberto Cirez - Software Developer --oo0oo-- =========== [EMAIL PROTECTED] ============= C, C++, Java, & Perl Linux development =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*= Sunny and Beautiful Vancouver, Canada. =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=




_______________________________________________ clug-talk mailing list [EMAIL PROTECTED] http://clug.ca/mailman/listinfo/clug-talk_clug.ca

Reply via email to