Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks,
I am trying to read a file and if it has the word unclassfied in it , to send to the good file and if not send to the bad file.
any suggestions.
#!/usr/bin/perl use warnings; use strict; #open 3 filehandles open Classified, "c:/begperl/classified1_sports.dat" or die "Error mes +sage here: $!\n"; open Good, ">c:/begperl/good.dat" or die "Error message here: $!\n"; open Bad, ">c:/begperl/bad.dat" or die "Error message here: $!\n"; while (<Classified>){ if (Classified == unclassified) print FH Good\n; else { print "bad\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: if statement
by tachyon (Chancellor) on May 08, 2002 at 05:55 UTC | |
Re: if statement
by IndyZ (Friar) on May 08, 2002 at 05:09 UTC | |
by tachyon (Chancellor) on May 08, 2002 at 05:48 UTC | |
by IndyZ (Friar) on May 08, 2002 at 05:52 UTC |
Back to
Seekers of Perl Wisdom