Here is the use strict; complaintuse strict; use warnings; use Text::CSV; EXTRACT_FIRST_COLUMN(my $TEMPCSV = 'C:\temp\part1.csv', my $TEMPTXT = +'TEMP_AM.txt', my $FINALCSV = 'C:\temp\OUT.CSV'); EXTRACT_FIRST_COLUMN(my $TEMPCSV = 'C:\temp\part2.csv', my $TEMPTXT = +'TEMP_CA.txt', my $FINALCSV = 'C:\temp\OUT2.CSV'); sub EXTRACT_FIRST_COLUMN { my $csv = Text::CSV->new(); open (FILE,">","$TEMPTXT"); open (CSV, "<", $TEMPCSV); while (<CSV>) { if ($csv->parse($_)) { my @column = $csv-> fields(); print FILE "$column[0]\n"; } else { #my err = $csv->error_input; print "ERROR: Failed to parse line: $err"; } } close (FILE); open (OUTPUT2,">","$FINALCSV"); my $file = $TEMPTXT; open (my $FH, "<", $file) or die $!; while (<$fh>) { my $uri = $_; $uri =~ s/\s+//g; my ($name, $aliases, $addrtype, $length, @addrs) = get +hostbyname $uri; my ($w,$x,$y,$z) = unpack('C4',$addr[0]); print OUTPUT2 "$w.$x.$y.$z\n"; } close (OUTPUT2); } sub EXTRACT_FIRST_COLUMN();
"my" variable $TEMPCSV masks earlier declaration in same scope at sub.pl line 9. "my" variable $TEMPTXT masks earlier declaration in same scope at sub.pl line 9. "my" variable $FINALCSV masks earlier declaration in same scope at sub.pl line 9. Global symbol "$err" requires explicit package name at sub.pl line 21. Global symbol "$fh" requires explicit package name at sub.pl line 29. Global symbol "@addr" requires explicit package name at sub.pl line 33. Execution of sub.pl aborted due to compilation errors.
In reply to Re: Passing arguments in a subroutine
by vinoth.ree
in thread Passing arguments in a subroutine
by enkiki
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |