On Tue, Mar 6, 2012 at 12:23 PM, Rob Dixon <rob.di...@gmx.com> wrote:
> Lina the code you have shown doesn't produce that warning. If you still
> need help then please post your current code.

Thank you. it's weird.
#!/usr/bin/env perl

use strict;
use warnings;
use File::Spec;
use File::Basename;

my $INPUTFILE = $ARGV[0];
my $tex_filename = $INPUTFILE;

my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib";
my $bib_abbrev_filename = "/home/lina/texmf/bibtex/bib/biophyabbrev.bib";

# 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_bib_filename = File::Spec->catfile($path,"$name.bib");

# Read bib_abbrevation file

open my $bib_output, '<', $bib_abbrev_filename;

open $bib_output, '>', $output_bib_filename
        or die "Could not write $output_bib_filename:$!\n";
####### Here I don't know why the try.bib is empty.
####### I upload the relevant file in below link,
https://docs.google.com/open?id=0B93SVRfpVVg3NXl6dVdZemdTb2VDaFhlbUs2Uk16dw
https://docs.google.com/open?id=0B93SVRfpVVg3M245NDl0QTlRRHFhU2lCUFQ4b3lMQQ

open my $texfile, '<', $tex_filename or die "Can't open ${tex_filename}:$!";

while (my $line = <$texfile>) {
        if( $line =~ m/cite\{(\S+)\}/g) {
                my $match_entry = $1 ;
                print $match_entry,"\n";
        }
}



>
> Rob
>
>
> On 06/03/2012 03:55, lina wrote:
>>
>> $ perl extract_v2.pl  try.tex
>> Useless use of a constant (<) in void context at extract_v2.pl line 25.
>> Useless use of private variable in void context at extract_v2.pl line 25.
>> metabolism
>> toxic2
>> toxic4
>>
>> #!/usr/bin/env perl
>>
>> use strict;
>> use warnings;
>> use File::Spec;
>> use File::Basename;
>>
>> my $INPUTFILE = $ARGV[0];
>> my $tex_filename = $INPUTFILE;
>>
>> my $bib_filename = "/home/lina/texmf/bibtex/bib/biophymd.bib";
>> my $bib_abbrev_filename = "/home/lina/texmf/bibtex/bib/biophyabbrev.bib";
>>
>> # 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_bib_filename = File::Spec->catfile($path,"$name.bib");
>>
>> # Read bib_abbrevation file
>>
>> open my $bib_output, '<', $bib_abbrev_filename;
>> (^^^^^^^^^^^^^^ here I wish to read the bib-abbrevation first into
>> bib_out, namely try.bib and then search the bib_filename (database)
>> for the enerties showed in the try.tex.)
>>
>> open $bib_output, '>', $output_bib_filename
>>        or die "Could not write $output_bib_filename:$!\n";
>>
>> open my $texfile, '<', $tex_filename or die "Can't open
>> ${tex_filename}:$!";
>>
>> while (my $line =<$texfile>) {
>>        if( $line =~ m/cite\{(\S+)\}/g) {
>>                my $match_entry = $1 ;
>>                print $match_entry,"\n";
>>        }
>> }
>>
>> $ more try.tex
>> bbbbb
>> aaaa \cite{metabolism}
>> ccc \cite{toxic2}
>> EEE \cite{toxic4}
>> ddd cite not
>>
>>
>> Thanks with best regards,
>>
>

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to