I have a small subroutine which fetch user details from Sybase DB. Please find my below subroutine.. Is there any way to return the query results from the subroutine straight away without using @uids array and $i variables.
sub sa_details { $dbh=Sybase::DBlib->new("user", "passwd", "host"); $dbh->dbcmd("SELECT userid FROM user"); $dbh->dbsqlexec or die "Can't execute SQL statement:\n"; while($dbh->dbresults!=NO_MORE_RESULTS){ $i=0; while(@row=$dbh->dbnextrow){ @uids[$i] = $row[0]; $i++; } return @uids; } $dbh->dbclose } @array = sa_details();
Please help me to make this code efficiently(not lousy). Thanks... Bheeshmaraja
In reply to Sybase Perl DBI by bheeshmaraja
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |