Re: How to end a loop

2012-03-14 Thread lina
This way works: ## read the .bib database and extract the cited out foreach $item (@citeditems){ match($item); } sub match{ open my $fh2, '<', $bib_filename; LINE: while(my $line = <$fh2>){ if ($line =~ m/@_\,/ .. $line =~ /^\}$/){

Re: How to end a loop

2012-03-14 Thread lina
## read the .bib database and extract the cited out open my $fh2, '<', $bib_filename; foreach $item (@citeditems){ match($item); } sub match{ my $reg = @_; LINE: while(my $line = <$fh2>){ if ($line =~ m/$reg\,/ .. $line =~ /^\}$/){

Re: How to end a loop

2012-03-14 Thread timothy adigun
Hi Lina, On Wed, Mar 14, 2012 at 10:15 AM, lina wrote: > Thanks all, here comes the update one: > > #!/usr/bin/env perl > > use strict; > use warnings; > use Carp qw(croak); > use autodie qw(open close); > use File::Basename; > > croak "Usage: ./bibextract.pl tex_file.tex" unless defined $ARGV[0

Re: How to end a loop

2012-03-14 Thread lina
Thanks all, here comes the update one: #!/usr/bin/env perl use strict; use warnings; use Carp qw(croak); use autodie qw(open close); use File::Basename; croak "Usage: ./bibextract.pl tex_file.tex" unless defined $ARGV[0]; my $infile = $ARGV[0]; my $tex_file = $infile; #my $bib_filename = "/hom

Re: How to end a loop

2012-03-14 Thread lina
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, '<',

Re: How to end a loop

2012-03-14 Thread lina
I updated a bit to sr/bin/env perl use strict; use warnings; use Carp qw(croak); use autodie qw(open close); use File::Basename; croak "Usage: ./bibextract.pl tex_file.tex" unless defined $ARGV[0]; my $infile = $ARGV[0]; my $tex_file = $infile; #my $bib_filename = "/home/lina/texmf/bibtex/bib/