in reply to Re: Regular Expression Assistance
in thread Regular Expression Assistance
If you know the absolute filename and want to open that file,
what prevents you from doing just that?
If the complete filename is in $filename you can do:
and end up with something like: "file23432545335.ext"
_Ass_uming safe input data here:
Anyway:my $filename = $ARGV[0] or die "No filename given\n"; open INPUT, "<", $filename or die "could not open $filename\n"; while (<INPUT>) { print $_ }; close INPUT;
If the complete filename is in $filename you can do:
my ($file_without_path) = $filename =~ /^.*?\/(\w*?\w*?\.ext)$/;
and end up with something like: "file23432545335.ext"
Still, I don't see the point if you trust the filename as being safe,
and just want to open it. (Since you will need the path anyway).
janx
|
---|
In Section
Seekers of Perl Wisdom