selva has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; my %hash = ( 'GREETING1' => 'HAI', 'GREETING2' => 'HELLO', ); my $value = '-GREETING1- James -POSITION-'; #Replace greetings value $value =~s/-(.+?)-/$hash{$1}/g; print "$value\n\n";
but I need the output like following,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Substitution problem
by ambrus (Abbot) on Jul 12, 2010 at 10:32 UTC | |
|
Re: Substitution problem
by JavaFan (Canon) on Jul 12, 2010 at 11:16 UTC | |
|
Re: Substitution problem
by BioLion (Curate) on Jul 12, 2010 at 10:36 UTC | |
|
Re: Substitution problem
by jethro (Monsignor) on Jul 12, 2010 at 11:06 UTC | |
|
Re: Substitution problem
by JavaFan (Canon) on Jul 12, 2010 at 10:32 UTC |