#!/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,
In reply to Substitution problem by selva
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |