Hi Monks, sorry for my silly question. I need to get data from file, as variables, and send them by using form to cgi program. Unfortunatelly, I can't read them outside loop. I tried to write a subroutine and get them by using return function, but it didn't work. Any ideas? Thanks.
#!/usr/bin/perl -w use strict; use CGI::Carp qw(fatalsToBrowser); print "Content-type: text/html\n\n"; my $file; print "<input type=\"file\" name=\"$file\" size=\"40\"> "; open (FILE, "$file"); while (<FILE>) { chomp; my ($name1, $name2, $address, $phone) = split("\t"); } close (FILE); print '<FORM name="form" ACTION="cgi.pl" METHOD="POST">'; print "<input type=\"hidden\" name=\"name1\" value=\"$name1\"> "; print "<input type=\"hidden\" name=\"name2\" value=\"$name2\"> "; print "<input type=\"hidden\" name=\"address\" value=\"$address\"> "; print "<input type=\"hidden\" name=\"phone\" value=\"$phone\"> "; print '<input style="width: 70px; height: 20px "type="submit" value="O +K" />'
In reply to Getting variables from file by przemek88
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |