onegative has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/local/bin/perl -w use Net::MySQL; use strict; sub get_all_records{ my $mysql = Net::MySQL->new( hostname => 'tspform02.sbms.sbc.com', # Default use UNIX soc +ket database => 'RTSERVER', user => 'nco', password => 'xxxxxxxx' ); $mysql->query(q{SELECT * FROM RTSERVER.SITESCOPE}); my $a_record_iterator = $mysql->create_record_iterator(); my @db; while (my $record = $a_record_iterator->each) { push(@db, "$record->[0]:$record->[1]:$record->[2]:$record->[3] +:$record->[4]:$record->[5]:$record->[6]:$record->[7]"); } $mysql->close; return @db; } get_all_records(); my $count = 1; foreach my $item (my @db){ # THIS IS PROBLEM,DIFFERENT array print "Record #$count: $item\n"; $count++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: passing variables from user defined function when use strict
by FunkyMonk (Bishop) on Aug 20, 2007 at 18:43 UTC | |
by onegative (Scribe) on Aug 20, 2007 at 21:07 UTC | |
|
Re: passing variables from user defined function when use strict
by akho (Hermit) on Aug 20, 2007 at 18:34 UTC |