Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^6: Search and Remove

by PyrexKidd (Monk)
on Jun 26, 2010 at 00:03 UTC ( #846624=note: print w/replies, xml ) Need Help??

in reply to Re^5: Search and Remove
in thread Search and Remove

Ok so here is my next attempt... but I'm having trouble.

#!/usr/bin/perl use strict; use warnings; #use diagnostics; if (@ARGV = 2){ my %delList; open (my $BEEPON, >>, "./beepon.file"); open (my $BEEPOFF, >>, "./beepoff.file"); open (my $DELLIST, <, $ARGV[0]); foreach (<$DELLIST>){ chomp($_); $delList{$_} = 1; } close $DELLIST; open (my $ORGLIST, <, $ARGV[1]); foreach my $entry (<$ORGLIST>){ chomp($entry); print { exists $delList{$entry} ? $BEEPON : $BEEPOFF } $entry +. "\n"; } close $BEEPON; close $BEEPOFF; }
here are the errors I get when running the code:
readline() on closed filehandle $DELLIST at ./ line + 12. Use of uninitialized value $ARGV[1] in concatenation (.) or string at +./ line 17. readline() on closed filehandle $ORGLIST at ./ line + 19. syntax error at ./ line 8, near ", >>" syntax error at ./ line 9, near ", >>" Unterminated <> operator at ./ line 10.



how can a file I just opened be closed?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://846624]
[M4ver1k]: I feel like being able to toggle a running script on the fly by updating variables from a config file using Config::Simple. But in the while loop, it seems like it doesn't update the variable after the first past. Is this generally just a bad idea?
[M4ver1k]: pass*

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2017-11-20 03:04 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (283 votes). Check out past polls.