in reply to Re: Checking number in file name
in thread Checking number in file name

Yes, it will be at that start of the file name but no underscore will be part of the file name:
my $filename = "000231263444_01_XY_20130110_061717.txt"; #after getting it with reg exp. my $accountnumber = '000231263444';

Replies are listed 'Best First'.
Re^3: Checking number in file name
by hdb (Monsignor) on May 19, 2013 at 17:28 UTC

    Splitting is probably better for you than using a regex. Especially if you later want to do something with the other parts of the filename, too.

    my ( $accountnumber, $part2, $part3, $part4, $part5, $extension ) = sp +lit /[_.]/, $filename;