in reply to Re^2: How to expand a string
in thread How to expand a string
use strict; #the substitution possibilities my @a = ('a'); my @b = ('d','e'); my @c = ('f','g','h'); my $string = pop(@_); #this is an argument passed to the script on th +e command line #my $string = "abc"; #if you want it hardcoded my $expanded_string = ""; my @strings = (); foreach my $first (@a){ foreach my $second (@b){ foreach my $third (@c){ $string = "$first$second$third"; push(@strings, $string); #to store them all print "$string\n"; #to print this particular one } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: How to expand a string
by Anonymous Monk on Nov 29, 2007 at 16:31 UTC | |
by BrowserUk (Patriarch) on Nov 29, 2007 at 16:52 UTC | |
by GrandFather (Saint) on Nov 29, 2007 at 20:10 UTC |