Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^3: Next Line Assigning to A Scalar

by davido (Cardinal)
on Oct 30, 2014 at 15:59 UTC ( [id://1105647]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Next Line Assigning to A Scalar
in thread Next Line Assigning to A Scalar

So implement the algorithm as follows:

  1. Read the first line. Print it. Store its values.
  2. Read the second line. Print it if it matches the first line that you stored. Now replace your stored line with the second line.
  3. Read the third line. Print it if it matches your stored line. Store the line.
  4. Read the fourth line. Print it if it matches your stored line. Store the line.
  5. Read the fifthe line. Print it if it matches your stored line. Store the line.
  6. Read the sixth line. Print it if it matches your stored line. Store the line.
  7. Read the seventh line. Print it if it matches your stored line. Store the line.
  8. Continue these steps again and again until out of lines.

Each time you are storing the current line so that on the next iteration you can refer back to it. Whenever you store the current line, it replaces the line you previously stored.

You still haven't taken the time to show us sample output that the program would produce with specific sample input. Anyway, get started implementing the algorithm I've described, and let us know when you're stuck.


Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found