« Perl » : différence entre les versions

m (1 révision importée)
Aucun résumé des modifications
 
Ligne 1 : Ligne 1 :
<keywords content="Perl"/>
{{#seo:|keywords=perl}}
== Trouver des fichiers avec un motif donné ==
== Trouver des fichiers avec un motif donné ==
<syntaxhighlight lang="perl">
<syntaxhighlight lang="perl">
Ligne 13 : Ligne 13 :
print "notfound d in @ar\n"  if ( grep (!/d/, @ar));
print "notfound d in @ar\n"  if ( grep (!/d/, @ar));
</syntaxhighlight>
</syntaxhighlight>
<br>


== Liens Externes ==
== Liens Externes ==

Dernière version du 23 septembre 2023 à 20:02

Trouver des fichiers avec un motif donné

opendir D, '.' or die "Could not open current dir: $!\n";
my @filelist = grep(/[A-Z]{2}_\w{2,5}/i, readdir D);
closedir D;

Trouver un élement d'une liste

my @ar = ( "a", "b", "c");
print "found b in @ar\n"  if ( grep (/b/, @ar));
print "notfound d in @ar\n"  if ( grep (!/d/, @ar));


Liens Externes