develooper Front page | perl.beginners | Postings from March 2012

Re: write to the file whose basename is argv[0]

Thread Previous | Thread Next
From:
Shawn H Corey
Date:
March 3, 2012 10:34
Subject:
Re: write to the file whose basename is argv[0]
Message ID:
4F526427.1020400@gmail.com
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...


-- 
Just my 0.00000002 million dollars worth,
   Shawn

Programming is as much about organization and communication
as it is about coding.

It's Mutual Aid, not fierce competition, that's the dominate
force of evolution.  Of course, anyone who has worked in
open source already knows this.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About