CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [aceall] UNIX path regex: Edit Log



7stud
Enthusiast

Feb 8, 2010, 12:25 PM


Views: 728
Re: [aceall] UNIX path regex


Code
use strict; 
use warnings;
use 5.010;

my @file_names = (
'/usr/hello/world',
'/apps/tomcat-9999',
'/goodbye/world',
);

for (@file_names) { #each file name gets assigned to $_

if ( /\/apps(\/tomcat\-[0-9]*)/ ) { #when no target specified, matches against $_
say $1;
}

}

--output:--
/tomcat-9999



(This post was edited by 7stud on Feb 8, 2010, 12:32 PM)


Edit Log:
Post edited by 7stud (Enthusiast) on Feb 8, 2010, 12:29 PM
Post edited by 7stud (Enthusiast) on Feb 8, 2010, 12:30 PM
Post edited by 7stud (Enthusiast) on Feb 8, 2010, 12:31 PM
Post edited by 7stud (Enthusiast) on Feb 8, 2010, 12:32 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives