Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I have a problem with my "fruity loops" they are not so fruity and sadly seem to loop forever.

I am having some problems embedding loops. I get this problem continuously and I don't know why.

Ok here is the problem I need to compare selected fields from two flat files.

I have extracted the one field I want from each line of the two files and placed it into two arrays.

Then using an if statement inside a for loop embedded in another for loop. This set up should compare each element of one array to every element of another array. The results being output to two flat files. respectivly matches and non matches. Instead of producing what I want it to it just goes into an infinite loop. I want to know why this occurs and how I can get over this problem? If anyone sends me a RTFM advisory they can stuff my output in there I/O and die. I am posting this because I would like help not abuse please.

Below is the code I have written to perform the task Feeble as it may be it should do the job. Would someone out there please be kind enough to point out what may be obvious to them but is sadly not obvious to freshmeat like me. Thankyou for your time.
for ( $i = 1 ; $i <= $#line ; $i++ ) { $k = $line[$i]; for ( $v = 1 ; $v <= $#angel ; $v++ ) { $j = $angel[$v]; if ( $k =~ m/($j)/i ) { push ( @a, $v ); } else { push ( @b, $v ); } } }

update (broquaint): added <code> tags

In reply to To infinity and beyond: Embedding loops by a_mere_kat

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 or How to display code and escape characters are good places to start.
Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2022-01-18 02:30 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (52 votes). Check out past polls.