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

Re^2: Comparing adjacent lines

by daccame (Initiate)
on Jul 10, 2012 at 17:12 UTC ( [id://980906]=note: print w/replies, xml ) Need Help??


in reply to Re: Comparing adjacent lines
in thread Comparing adjacent lines

As you could probably tell, I'm new to Perl, so thanks for being gentle :) Thanks for the comments, they were extremely helpful. After the loop I am creating a new file; this program is for changing file formats.

One thing though: after ex# has been replaced with ex1, the subsequent ex# with matching @gtf[9] don't count up from ex1. They revert to the original ex# value+1 and count from there. I think that rather than taking the new ex1, its using the default ex# (like you said, changes made to @gtf are clobbered when the loop restarts). I guess I could specify ex1 as its own variable before the loop, like The Code Captain suggested...I'll test and see what happens.

Replies are listed 'Best First'.
Re^3: Comparing adjacent lines
by daccame (Initiate) on Jul 12, 2012 at 14:27 UTC

    I've been trying out different things and just can't get it to work...any ideas?

      Lots of them, depending on what "doesn't work" means.

      Aaron B.
      Available for small or large Perl jobs; see my home node.

        Right you are, my apologies. The ex values that are not "ex1" (ex1 is produced at a mismatch in the comparison) revert to the default value of ex# (for example, ex18 or ex30) instead of counting up from 1. Basically, what I think is happening is ex1 is not passed on to the else part, since ex values get clobbered after one iteration of the loop. I've been trying variations of an ex variable external to the loop, but can't seem to figure it out.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found