Hi John! ----- Original Message ---- > From: John W. Krahn <[EMAIL PROTECTED]> > To: Perl Beginners <beginners@perl.org> > Sent: Tuesday, January 16, 2007 8:15:36 AM > Subject: Re: Hash variable is not imported?? (Re: Storing File Handles for > writing)
> > > > open( LOGFILE, '<', $logfile ) or die "Can't open $logfile: $!"; > > while(my $log = <LOGFILE> ){ > > (my $deviceid) = $log =~ /device_id=(\S+?),/; > > if (exists $clientdevice{$deviceid}){ > > open FH, '>>', $clientdevice($deviceid) or die $!; > Change the parentheses () to braces {} there: Holly cow! Sorry about this one. I shouldn't have done this on a putty terminal, my mistake, can't spot the difference between () and {}. Thank you very much John! You're a certified perl guru! :-) > open FH, '>>', $clientdevice{$deviceid} or die $!; > > print FH $log; > > close FH; > > } > > } > > > > The "if exist" line keeps on complaining: > It is actually the line after that one that has the problem. > > Variable "$clientdevice" is not imported at extractdevice.pl line 23. > > Global symbol "$clientdevice" requires explicit package name at > > extractdevice.pl line 23. > > syntax error at extractdevice.pl line 23, near "$clientdevice(" > Line 23 is: > > open FH, '>>', $clientdevice($deviceid) or die $!; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ ____________________________________________________________________________________ Sucker-punch spam with award-winning protection. Try the free Yahoo! Mail Beta. http://advision.webevents.yahoo.com/mailbeta/features_spam.html