Gossamer Forum
Home : General : Perl Programming :

3rd value in file as "value" in form???

Quote Reply
3rd value in file as "value" in form???
I have a form I am building that reads in a temp file (/tmp/prnt_admin_565.lst).

Within this file is data as such. I ignore the first two lines and start reading on the third line for my data.

CFD-005 is ready and printing
Rank Owner Job File(s) Total Size
active applsilp 496 /etc/hosts 203 bytes
1st applsilp 497 /etc/hosts 203 bytes

I want to take the third column (496, 497) and use this values to set in an html form the "value" parameter. (Replace what I currently have set as "$count" as noted below in the code).

The command "cat /tmp/prnt_admin_565.lst |cut -f 3"

CFD-005 is ready and printing
Job
496
497

returns the data I need but how can I incorporate something like this in my code for the current line I am reading?

Any ideas?

Here is the code I have that currently does a count and increments the "value" by 1. I need this number above in order to complete the code for a customized printer cancel job.

***************************************************

open(IN,"$query0");
my @IN = <IN>;
close(IN);

# Arrays start at 0, not 1
# hence the subtraction
$starting_line = 3 - 1;

print "<table border=0 width=90%>\n";
print "<form method=\"post\" action=\"$prnt_stat_url\">";
print "<input type=\"hidden\" name=\"rt\" value=\"prnt_job_del\">";
print "<input type=\"hidden\" name=\"prnt_name\" value=\"$prnt_name\">";
print "<input type=\"hidden\" name=\"tmp_file\" value=\"$query0\">";
print "<tr><td align=left>&nbsp;</td></tr>";

for ($starting_line..$#IN) {
$count = $count + 1;
print "<tr><td><input type=\"radio\" name=\"job_queue\" value=\"$count\">$IN[$_]</td></tr>";
}
print "<tr><td><input type=\"radio\" name=\"job_queue\" value=\"first_job\" checked>Delete <b>FIRST Job</b> in the
Print Queue for $prnt_name</td></tr>";
print "<tr><td><input type=\"radio\" name=\"job_queue\" value=\"all_jobs\">Delete <b>ALL Jobs</b> in the Print Queu
e for $prnt_name</td></tr>";
print "<tr><td align=left>&nbsp;</td></tr>";
print "<tr><td colspan=4 align=center><input type=\"submit\" value=\"Delete Print Queue Jobs\"></form></td></tr>";
print "</table>";
} # end else

print "<p>";


***************************************************

Thanks in advance!