in reply to Re: Checking number in file name
in thread Checking number in file name
Any example of how the same process could be done using "GLOB"?#!/usr/bin/perl use strict; use warnings; my @files = qw( 000231263444_01_XY_20130110_061717.txt 17034513_01_WQ_ +20130511_053551.txt 12345670_01_XY_20130110_061717.txt BOA034513_01_W +Q_20130511_053551.txt); foreach my $file(@files) { $file =~/(^\w+)_(\w{1,2})_(\w{1,2})_(\w+)_(\w+)\.txt$/i; #my $accountnumber = $1; # test my $accountnumber = "BOA034513"; if( ($file=~/$accountnumber/gi) && ($accountnumber=~/\w{7,}/g) ) { print "\n Found - *$accountnumber* - *$file*\n"; }else{ print "\n Not Found - *$accountnumber* - *$file*\n"; } }
|
|---|