Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unintialized value $_ in concatenation <.> or string

Status
Not open for further replies.

weston2012

Programmer
Jun 26, 2012
1
US
while (my @usr = $stu->fetchrow_array)
{
foreach ( @usr ) {print STROUT $_ . "\t"}
}

I am getting a weird error msg complaining about the print statement having 'unintialized value $_ in concatenation <.> or string'

$stu->fetchrow_array returns query results, and the code tries to print the items in each row with tabs seperating them.

I am quite new to Perl, and I inherit the code from someone before me, but it really baffles me how this line would give me an error.
 
check if it's an uninitialised value, and if it isn't, print it ...

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Something like this perhaps:

Perl:
foreach ( @usr ) {print STROUT $_ . "\t" if defined $_;}

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top