Dan Muey wrote: >> You've got it, only, don't return anything. >> >> Here is a command-line example: >> >> perl -le'sub v{${$_} = ++$c for qw[x y z]} v; print "$x $y $z"' >> >> This is basically exactly what you have there. It's not >> supposed to "return" variables, but rather "create" variables. >> >> Just a note, this is generally unelegant and therefore >> usually the wrong approach to solve a problem. > > That what I'd say also except here I'm using a series of numbers > for(100..1000) { } Each one has the same string except the number is > different And then want to just declare them all with one call and use > them as I want. > > I'm glad to know that principle works, thanks. > > Any idea how to get it to be friends with use strict; ?? >
here is one way: #!/usr/bin/perl -w use strict; sub makevars{ no strict; eval "\$var$_ = 4" for(1..1000); } makevars; #-- #-- either turn off use strict or tell Perl where is $var1 and $var2 #-- print "$main::var1\n"; print "$main::var2\n"; __END__ others have pointed out why this is a bad idea. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]