Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: concatenating variables

by brx (Pilgrim)
on Jul 31, 2012 at 17:37 UTC ( #984633=note: print w/ replies, xml ) Need Help??


in reply to concatenating variables

Very quick answer : don't 'forge' variable name. Use an array. If you realy need to 'forge' name, use an hash:

my %names; $names{$linename.$counter} = "use pricedb;" ;

With an array:

#my $line1 = "use pricedb;"; my @lines = ( "use pricedb;" , "..." , "..." , ); for my $counter (1 .. 10) { my $rowsaffected = $dbh ->do($lines[$counter]); #...

Better, without $counter:

for my $line (@lines) { my $rowsaffected = $dbh ->do($line); #...

English is not my mother tongue.
Les tongues de ma mère sont "made in France".


Comment on Re: concatenating variables
Select or Download Code
Re^2: concatenating variables
by Anonymous Monk on Aug 02, 2012 at 09:01 UTC
    Many thanks all - works a treat - problem now solved, and am reading the 'Learning Perl' book... Best wishes..

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://984633]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2015-07-02 06:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (29 votes), past polls