
7stud
Enthusiast
Feb 8, 2010, 12:25 PM
Post #3 of 3
(496 views)
|
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)
|