| [reply] [Watch: Dir/Any] |
I want to print content of the array. I have used following code for that
use TeamSite::WFsystem ;
$system = new TeamSite::WFsystem() ;
@jobs = $system->GetActiveWorkflows();
foreach $job (@jobs){
print "$job \n" ;
}
why am I still getting reference to array printed out ?
| [reply] [Watch: Dir/Any] |
| [reply] [Watch: Dir/Any] [d/l] |
Since numerous people have told you already that ->GetActiveWorkflows() returns an arrayref instead of an array, here's the code that does something useful with that:
use TeamSite::WFsystem ;
$system = new TeamSite::WFsystem() ;
my $ar_jobs = $system->GetActiveWorkflows();
foreach my $job (@{$ar_jobs}){
print "$job \n" ;
}
Assuming that $job will contain something printable, of course.
@{$ar_jobs} dereferences the arrayreference, which gives you the array that $ar_jobs references to. I usually prefix my arrayref and hashref variables with ar_ and hr_ respectively, so I can easily see what kind of reference I'm dealing with. This is not required, but imo easier to spot. | [reply] [Watch: Dir/Any] [d/l] [select] |