#!/usr/bin/perl -w use strict; my @ss = getItemsFromFile(); foreach my $s (@ss) { print "$s\n"; } sub getItemsFromFile { local $/=undef; my ($line_in) = "\n\n \n\n \n\n"; my @allItems=(); while ($line_in =~ m{<(.*?)stylesheet(.*?)>}gis) { push (@allItems, $1); } return @allItems; }