I'm getting an error that "$cgi" requires an explicit package. wouldn't that be 'use CGI qw/:standard/;'?
#!/usr/local/bin/perl
use Data::Dumper;
use strict;
use CGI qw/:standard/;
my $value = $cgi->param('value');
open FILE , "facultydummy.txt" or die "Cannot open: $!";
#my $rowid = $ARGV[0] || '$roy';
my $rowid = $ARGV[0] || 'value';
my %data = ();
my @fields = split(/\t/, <FILE>);
chomp @fields;
while(<FILE>) {
chomp;
my @row = split(/\t/);
if ($row[0] eq $rowid) {
@data{@fields} = @row;
last;
}
}
print "Content-type: text/html\n\n";
if ( keys %data ) {
# found, display data
print Dumper \%data;
}
else {
# not found, show error
print STDERR "Can't find row '$rowid'\n";
}
In reply to CGI PM
by malaga