vendredi 31 juillet 2015

remove a part in array value without foreach

for example i have this array

my @a = ("http://aze.com/azfaz","http://acc.com/azfssz");

i want to romove this part in sites in the array (azfaz,azfssz) without foreach i made this sub to romove the last after the 3 /

sub cheat {
my @o = split(/\//,$_[0],3);
my @r = split (/\//,$o[2],0);
return $r[0];

}

when i make cheat(@array); it just remove the azfaz from the first site in array and not working from the other

Aucun commentaire:

Enregistrer un commentaire