in reply to Help on parsing an array
if that IS what you are starting with, then this should work - use 'split' to split each line:my @input_array = ("href=\"/something/something1/html\"", "href=\"/abc.html\"", "href=\"blah.html\"", "href=\"/dir1/dir2/dir3/test\"")
Use with a grain of salt, since this is completely untested, but it should be close. I'm not sure if each double quote needs to be escaped in the regular expression.foreach $array_element (@input_array) { my ($href_text, $href_directory) = split /=/, $array_element; ### now take off the leading and trailing double quotes ### my $href_dir_no_quotes = ""; if ($href_directory =~ /^"(.*)"$/) { $href_dir_no_quotes = $1; } }
|
|---|