You almost have it right. If I change $kb_lay_img_url=$&; to $kb_lay_img_url=$1;, it works for me. (see: Special Variables)
EDIT: Here, I've made this change (and added Anon's suggestion, which makes the regex safer/better):
#!/usr/bin/env perl
use strict;
use warnings;
use feature 'say';
my $line =
"</div><div class='ClipPicture'><a href='http://www.laptop-keys.com/Ke
+yboardKeys/Cart/Acer/A_Series/A110/A8A'><img alt='Clip Style Pic' src
+='http://www.laptop-keys.com/images/KeyboardImages/A8A.png' width='65
+9' height='135'/></a></div><div class='RadioButtonContainerClipStyle'
+>";
if ($line=~ /<img .* src='([^']+)'.*\/><\/a>/) {
print "got2\n";
my $kb_lay_img_url = $1;
say $kb_lay_img_url;
}
__END__
got2
http://www.laptop-keys.com/images/KeyboardImages/A8A.png
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Outside of code tags, you may need to use entities for some characters:
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|