#!/bin/perl my @view = ("ignore","ignore","dont\\ignore\\this.vms","ignore"); my %functions_hash = ( '\.vms' => 's/\///'); foreach my $data (@views) { while (($key, $value) = each %functions_hash) { if( $data =~ /$key/ ) { $data =~ $value; print "data is now $data\n"; } } }
In reply to Using a regex function from a hash by perlNinny
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |