No offense, but you don't even have the basics. Your dept won't worry about the speed of Perl so much as your proficiency with it.
You might want to start with Learning Perl. Then you might want to take a look at Mastering Regular Expressions, though you could save a few bucks and start with perlrequick and perlretut first.
To help you understand what's going on, let's reformat what you've got so we can see what we should search for:
my $line_in = <<EOT;
<?xml-stylesheet href="perl1.css" type="text/css"?>
<link href="//www.perl.org/css/perl1.css" rel="stylesheet">
<link href="/css/perl.css" rel="stylesheet">
EOT
You say you want to pull out the hrefs, but you use this pattern:
my @ss = $line_in =~ m{<(.*?)stylesheet(.*?)>}gis;
which says to find an angle bracket and save 0 or more chars as $1 (that's what
the parens do) until you find "stylesheet". Skip "stylesheet" and then save
0 or more chars as $2 until you find a closing angle bracket. Ignore line
breaks. Here is what you'll get:
$1 $2
|----| |--------------------------------|
<?xml-stylesheet href="perl1.css" type="text/css"?>
$1 $2
|--------------------------------------------| |
<link href="//www.perl.org/css/perl1.css" rel="stylesheet">
$1 $2
|-----------------------------| |
<link href="/css/perl.css" rel="stylesheet">
If you want to capture the hrefs, try matching them instead:
my @ss = $line_in =~ m/(href="[^"]+")/gi;
print "$_\n" for @ss;
#
# href="perl1.css"
# href="//www.perl.org/css/perl1.css"
# href="/css/perl.css"
If you're looking for an href within a tag that contains the word stylesheet, where the word stylesheet may appear before or after the href...well, that's a little more complicated. Here it is, but you'll have to figure out how it works on your own.
my @ss = $line_in =~ m/<(?=[^>]*stylesheet).*(href="[^">]+")/gis;
--marmot
|