Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Need to return the first occurance of a search

by hdb (Monsignor)
on Apr 18, 2013 at 15:11 UTC ( [id://1029373]=note: print w/replies, xml ) Need Help??


in reply to Need to return the first occurance of a search

The distinguishing factor is that a hyphen and a digit follow the name you are looking for.

use strict; use warnings; my @array1 = qw/ cups-1.5.2-9.fc16.x86_64 cups-libs-1.5.2-9.fc16.x86_6 +4 cups-1.5.2-9.fc16.x86_64/; my @array2 = qw/ cups-libs-1.5.2-9.fc16.x86_64 cups-libs-1.5.2-9.fc16. +x86_64 /; my $pattern = "cups"; print "Array1:\n", join "\n", grep { /^$pattern\-\d/ } @array1; print "\nArray2:\n", join "\n", grep { /^$pattern\-\d/ } @array2;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1029373]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2024-04-19 15:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found