Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: how to match figure and chapter no?

by hdb (Monsignor)
on May 06, 2013 at 10:17 UTC ( [id://1032228]=note: print w/replies, xml ) Need Help??


in reply to how to match figure and chapter no?

Assuming you want output only if there is a matching chapter and figure number:

use strict; use warnings; # avoid using $a and $b my $f='figure1 vdfsvh figure3 vdsvjjh'; my $ch='chapter 3 svbjjvfh chapter5'; my @figs = $f =~ /figure\s*(\d+)/g; my %chaps; $chaps{$_}++ for ( $ch =~ /chapter\s*(\d+)/g ); for my $i (@figs) { print "href=\"chapter $i.html#figure $i\">figure $i\n" if exis +ts $chaps{$i}; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1032228]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-04-19 08:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found