On Fri, 11 Jan 2002 04:39:05 -0800, [EMAIL PROTECTED] (John W. Krahn) wrote:
>Zentara wrote: > >> I've been playing with File::Basename and >> the docs are not absolutely clear on whether >> you can get an extension on a linux system. >> I have had no success trying, so does this mean >> that linux is not capable of dealing with extensions? >> >> As an example from perldoc File::basename: >> ############################################### >> #!/usr/bin/perl -w >> use strict; >> use File::Basename; >> my($base,$path,$type) = fileparse('/virgil/aeneid/draft.book7'); >John wrote: > >The example actually is: > >( $base, $path, $type ) = fileparse( '/virgil/aeneid/draft.book7', '\.book\d+' ); > >Where the second argument to fileparse() is a regular expression (which >is why there is a back-slash in front of the period.) If you have to tell it the extension beforehand, then it dosn't seem to be very useful in extracting the extension. What would the regex be to find any extension? What would the wildcard be to substitute for '\.book\d+' ?? Would it be '\.\w+|d+' ?? that works for this example. I'm sure the regex has to be more complex to account for any legal extension, consisting of any legal character, in any order. Why dosn't the module use a wildard value as default if none is specified? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]