in reply to how do I edit multiple variables at once?
I would suggest using a hash (or, as in the following example, a hash reference) to contain those variables, in conjunction with map, like this:
use strict; use warnings; my $h_vars = { 'name' => '<h1>Fred Flintstone</h1>', 'location' => 'Bedrock', 'favorite movie' => 'One <i>Million</i> Years B.C.', 'favorite book' => 'Danny the <b>Dinosaur</b>', }; map { s/\</\<\;/g; s/\>/\>\;/g } values %$h_vars; # Test code use Data::Dumper; printf "Results %s\n", Dumper($h_vars); __END__ Results $VAR1 = { 'location' => 'Bedrock', 'favorite movie' => 'One <i>Million</i> Years B. +C.', 'name' => '<h1>Fred Flintstone</h1>', 'favorite book' => 'Danny the <b>Dinosaur</b>' };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how do I edit multiple variables at once?
by merlyn (Sage) on Jul 04, 2009 at 03:23 UTC |