Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Your example output is not quite correct and I think your problem is still not fully specified. However, have a look at this and see whether you can adapt it for your purposes.

use strict; use warnings; sub check_condition { my( $inst, $cond, $ors ) = @_; OR: for ( @$ors ) { $inst !~ /$_/ and next OR for @$_; return 1; } return 0; } sub check { my( $inst, $list ) = @_; return grep { check_condition $inst, $_, $list->{$_} } keys %$ +list; } my %conditions = map { /^(.*?)=(.*)$/; $1 => [ map { [ split /,/ ] } split /\|\|/, $2 + ]; } <DATA>; my @instances = qw( IDL_MANAGEMENT_101001 IDL_NORTH_TX IDL_SOUTH VIDL_ +NORTH ABX_PERL ); print "$_:", join(",",check( $_, \%conditions )), "\n" for @instances; __DATA__ MANAGEMENT=IDL NORTH=IDL,NORTHERN||VIDL,NORTH||IDL,NORTH SOUTH=IDL,SOUTHERN||CIDL,SOUTH

In reply to Re: Create a expression to cmpare a formal against a string by hdb
in thread Create a expression to cmpare a formal against a string by learnP

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

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

    No recent polls found