#!/usr/bin/perl -w use strict; my @ss = getItemsFromFile(); foreach my $s (@ss) { print "$s\n"; } sub getItemsFromFile { local $/=undef; my ($file_in) = "\n \n\n"; my @allItems=(); while ( $file_in =~ m{(.*stylesheet.*)}igs ) { my $line = $1; $line =~ s/>\s+\\n]/ig ) { my $line1 = $1; if ( $line1 =~ m/(href *= *['"])([^'"]+)['"]/ ) { push(@allItems, $2); } } } return @allItems; }