Bonjour,
J'ai un problème pour retourner une liste d'url d'un tableau.
J'ai donc un tableau comme ceci :Quand je fait un grep sur "http://www.toto.fr/dossier1/index.html"
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 http://www.toto.fr/dossier[1|2]/index.html http://www.titi.fr/dossier/index.html http://www.toto.fr/dossier1/index.html http://www.toto.fr/dossier2/index.html http://www.titi.fr/
J'aimerai que le grep me retourne : http://www.toto.fr/dossier[1|2]/index.html et http://www.toto.fr/dossier1/index.htm
Avec mon code il ne me retourne que http://www.toto.fr/dossier1/index.html
Voilà mon code :Merci d'avance pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 #!/usr/bin/perl use strict; use Data::Dumper; my @url = qw("http://www.toto.fr/dossier[1|2]/index.html" "http://www.titi.fr/dossier/index.html" "http://www.toto.fr/dossier3/index.html" "http://www.toto.fr/dossier4/index.html" "http://www.titi.fr/"); my $addr = "http://www.toto.fr/dossier1/"; my @result = grep { /$addr/ } @url; print Dumper @result;
Franpom
Partager