open my $fh, '<', $tex_file;
while(<$fh>){
        if(/cite\{(\S+)\}/){
                $cited = sprintf "%s\n",$1;
                $cited =~ tr/\,/\n/;
                push(@citeditems,$cited);
                }
}
close($fh);


## read the .bib database and extract the cited out
open my $fh2, '<', $bib_filename;

for my $item (@citeditems){
        #print $item;
        match($item);
        }

                
sub match{
        my $reg = @_;
        LINE: while(my $line = <$fh2>){

                if ($line =~ m/$reg\,/){
                        print $line;
                last;
                }
        

        }
}

I am really so confused, why the result is

$ ./bibextract.pl sample.tex
@Article{ dehydron1,

Thanks,

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/


Reply via email to