Saturday, November 1, 2008

Using regex in Map function

need to localize if you want not to get all 1's as output of the map (since match return is
only 1, regexp substitution occurs in place with $_).

#!/usr/bin/perl -w
use strict;

open (IN, "list");
my @data=;
my @out= map { local $_ =$_; s/(.*href=\")(.*)(\".*)/$2/; $_} @data;

see merlyn at

http://www.perlmonks.org/index.pl?node_id=613280