Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
good chemistry is complicated,
and a little bit messy -LW

How do I read from one file and write my processed results to another file?

( #118844=categorized question: print w/ replies, xml ) Need Help??
Contributed by Zombie sandmuto on Oct 15, 2001 at 14:33 UTC
Q&A  > files


I have written code that accepts input from one file named pa1.dat. It checks whether the input is accepted by a certain finite automaton. If it is, then it is supposed to output the results in another file named pa1.out. The problem is that after compling successfully without any errors, the pa1.out file doesn't contain anything. Would you please tell me the correct syntax on how to get the data from one file and direct output to another file?

Answer: what statements are used in order to obtain results in another file?
contributed by davorg

This is still the Finite Automata problem from the University of Zimbabwe isn't it?

In order to read or write from a file, you need to first open a filehandle. Here's a link to the documentation on open.

You output data to a file using the print function. Documentation on print is here.

If you have any further questions, perhaps you could show us the code - we'd then be able to be more help.


  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Log In?

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

    How do I use this? | Other CB clients
    Other Users?
    Others pondering the Monastery: (10)
    As of 2014-03-17 11:13 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (346 votes), past polls