in reply to regular expression for filename

I think that you are thinking of opening a file for input. You won't need a regex for that. For example, here's the simplest example that I could think of to get you started:
#!perl #xyz.pl use strict; use warnings; my $file = '3-4-111.txt'; open FH, '<', $file or die $!; my(@lines) = <FH>; @lines = sort @lines; foreach my $line(@lines) { print $line, "\n"; } close FH;
Now, if you need to find all the files in a directory that end in .txt, you could use glob:
#!/usr/bin/perl use strict; use warnings; my @files = glob('/your/dir/*.txt'); foreach my $file(@files) { print $file, "\n"; }
To answer your first question---A regex for finding a file with the extension .txt would simply be: /\.txt$/.