
fashimpaur
User
Jun 28, 2002, 5:23 AM
Post #2 of 10
(3596 views)
|
|
Re: [etheracide] Simple regex problem
[In reply to]
|
Can't Post
|
|
etheracide, The proper way to strip off the file name from the extension would probably be to use the module File::Basename. If you were going to strip of the the extension with a regex, I would do this: my $filename = "database.dat"; print (stripExtension($filename), "\n"); $filename = "turtle.dat"; print (stripExtension($filename), "\n"); $filename = "simple.txt"; print (stripExtension($filename), "\n"); sub stripExtension($) { my $input = shift; $input =~ /(.*)(?=\.(.+)$)/g ; my $output = $1; return $output; } Output from script: database turtle simple
Hope that helps. Dennis $a="c323745335d3221214b364d545". "a362532582521254c3640504c3729". "2f493759214b3635554c3040606a0", print unpack"u*",pack "h*",$a,"\n\n";
|