On 04/03/2012 09:24, lina wrote: > On Sun, Mar 4, 2012 at 2:34 AM, Shawn H Corey<shawnhcorey@gmail.com> wrote: >> On 12-03-03 11:37 AM, lina wrote: >>> >>> my $tex_filename = $ARGV[0] ; >> >> >> # for catfile() >> use File::Spec; >> >> # divide the input file name into its path and name, >> # ignore its extension >> my ( $name, $path ) = fileparse( $tex_filename, qr/\.[^\.]+$/ ); >> >> # create a new name with .bib extension >> my $output_text_filename = File::Spec->catfile( $path, "$name.bib" ); >> >> # open the file >> open my $bib_output, '>', $output_text_filename >> or die "could not open $output_text_filename: $!\n"; >> >> # etc... > > $ perl extract_v2.pl try.tex > Undefined subroutine&main::fileparse called at extract_v2.pl line 16. The fileparse function is in File::Basename, so you need to add use File::Basename; before you can use Shawn's code. RobThread Previous | Thread Next