On Nov 26, Etienne Marcotte said: >open (DIR, $fd) or die "Can't open directory: $!"; >readdir(DIR); >close(DIR); >splice(@_,0,2); #remove . and ..
readdir() doesn't read into @_. @files = grep $_ ne '.' && $_ ne '..', readdir DIR; >foreach(@_) { foreach (@files) { > open(FILE, $fd/$_); open FILE, "$fd/$_"; > while (<FILE>) { > $_ =~ tr/KARMA1N3/N3V3RL4ND/g; # replace all KARMA1N3 with N3V3RL4ND tr/// is not s///. And you want to use \b (word boundary). s/\bTHIS\b/THAT/g; > print FILE $_; > } > close(FILE); >} Hope that helps. >Mr.Foo: What's the age of your children Mr. Bar? >Mr.Bar: I have 3 children, the multiplication of their ages is 36. >Mr.Foo: This doesn't help very much. >Mr.Bar: Well if you add their 3 ages, you get the number fo windows in >my house. >Mr.Foo: I know how many windows there are in your house, but that >doesn't tell me the age of your children. >Mr.Bar: The oldest have blue eyes. >Mr.Bar: Ahhhh, now I know Sets of three numbers that multiply to 36: 1 * 1 * 36 1 * 2 * 18 1 * 3 * 12 1 * 4 * 9 1 * 6 * 6 2 * 2 * 9 2 * 3 * 6 3 * 3 * 4 "The oldest have blue eyes." That statement, assuming there's no messed up grammar, indicates that the oldest are TWO OR MORE persons. If it said "the oldest has blue eyes", then there could only be one person with the highest age; but since it says "the oldest have blue eyes", that means that more than one person has the highest age. The combination is (1,6,6). -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]