Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have an array(34 elements total) of hashes. I intend to keep a "print format" for the data type I'm accessing. The code below is just to test the mechanism.
Should print: NEWNAME -> stuff2-10my $dash = '-'; my ( $prefix, $suffix, @range, ); my $format = "%s%d%s%d"; my $args = [$prefix, $range[0], $dash, $range[1],]; $prefix = "stuff"; $range[0] = 2; $range[1] = 10; my $new_name = sprintf ("$format", @$args); print "NEWNAME -> $new_name\n";
Maybe someone could point me in the right direction?
TIA for all the help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: dynamic string format?
by jlf (Scribe) on Jan 09, 2002 at 04:58 UTC | |
by Anonymous Monk on Jan 09, 2002 at 05:38 UTC | |
|
Re: dynamic string format?
by metadoktor (Hermit) on Jan 09, 2002 at 06:39 UTC | |
|
Re:(fix) dynamic string format?
by Anonymous Monk on Jan 09, 2002 at 06:23 UTC |