Global symbol "$houtputfile" requires explicit package name at good.pl + line 12. Global symbol "$pid" requires explicit package name at good.pl line 12 +. Global symbol "%hfiles" requires explicit package name at good.pl line + 30. Global symbol "%hfiles" requires explicit package name at good.pl line + 38. Global symbol "%hfiles" requires explicit package name at good.pl line + 39. use strict; use warnings; my $input_file = $ARGV[0]; #input file name my $input_pid = $ARGV[1]; #input pid number my $input_string = $ARGV[2]; #input string to be searched print "Usage:perl file.pl <input file name> <input process id> <input + file string>" if (@ARGV != 3); open (my $hfile, '<', "$input_file") || die("Unable to open the file $ +input_file\n"); open (my $houtputfile, '>', "$houtputfile.$pid") || die("Unable to ope +n the file output.txt\n"); $hfile = *HFILE; my %hFiles = (); while (<$hfile>){ #read the file line by line my $line = $_; if ($line =~ /[DWEM]\s+.*?\s+(?:c|cm|M)\:($input_pid)\s+([^\.]+\.c +)/s) { my $c_file = $2; my $pid = $1; if($input_string eq $c_file){ #check with input string and I +f it matches # print $houtputfile "$line\n"; #write the output in a output + file $houtputfile = $hfiles{$pid}; if($houtputfile) { print $houtputfile "$_\n"; } else { print ("pid = $pid\n"); open( HPIDFILE.$pid,">$houtputfile.$pid") #open( $hfiles{$pid},">$houtputfile.$pid") or die("failed to open $houtputfile.$pid "); $hfiles{$pid} = *HPIDFILE.$pid; $houtputfile = $hfiles{$pid}; print $houtputfile "$_"; } } } }
In reply to Requires explicit package name by jaggu_bg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |