Hi,
So I started to learn perl a few days ago, and I have some problems...
One of my problems...
PHP Code:
#!C:\Perl64\bin\perl.exe -w
use LWP::Simple;
print "Content-Type: Text/Plain\n\n";
sub pagelinks {
return @all = get($_[0]) =~ /href\s*=\s*"?([^"\s>]+)/gis;
}
@a = pagelinks("http://website.com");
foreach $key (@a){
print $key."\n";
}
so I tried using some regex I usualy have used in php with preg_match but they don't seem to work. So I got the above regex after searching google..
and tbh I don't understand it..
What I understand from it : href followed by none or more whitespaces followed by = followed by none or more whitespaces followed by 0 or 1 " and afterwards... I don';t get it at all! it's really frustrating.
my second problem..
let's assume I have this array :
@horse = ("mdamdamad" , "asdasda" ,"asdasd" ,"a");
I want to delete the element which is equal to "a".
foreach $key (@horse){
if ($key == "a"){
delete $horse[$key];}
}
the above code doesn't seem to work.. it deletes the @horse[-2] value. I have also tryied using $key =~ /a/ and (grep $key eq "a",@horse). All have failed me.. any suggestions? please...