in reply to Capture output of a while loop into a variable
There's quite a few ways to skin this cat, some of them better than doing it in the while loop, but since you said you want to do it in your while loop, you can do that this way without changing your existing code:
my @save4later ; while ($status == $CQPerlExt::CQ_SUCCESS) { my $Environment = $resultSet->GetColumnValue(1); my $Release = $resultSet->GetColumnValue(2); my $Project = $resultSet->GetColumnValue(3); my $VLS_Name = $resultSet->GetColumnValue(4); my $AppServerName = $resultSet->GetColumnValue(5); my $State = $resultSet->GetColumnValue(6); my $URL = $resultSet->GetColumnValue(7); push @save4later, { Environment => $Environment, Release => $Release, Project => $Project, VLS_Name => $VLS_Name, AppServerName => $AppServerName, State => $State, URL => $URL, } ; print <<END_HTML; <table border="1" cellpadding="8" bgcolor="#CCD6F5"> <tr> <td><input type="checkbox" value="$VLSName"/></td> <td>$Release</td> <td>$Environment</td> <td width="160">$Project</td> <td width="430"><a href="$URL">$URL</a></td> </tr> </table> END_HTML # next row in result set $status = $resultSet->MoveNext; } use Data::Dumper; print Dumper(@save4later);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capture output of a while loop into a variable
by premal (Acolyte) on Sep 27, 2011 at 08:34 UTC | |
by onelesd (Pilgrim) on Sep 27, 2011 at 18:30 UTC |