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

Re: need urgent help for

by parv (Priest)
on Jan 14, 2013 at 12:40 UTC ( #1013208=note: print w/replies, xml ) Need Help??

in reply to need urgent help for

  1. open file ("file1") to read;
  2. read a line;
  3. split it in 3 parts on white space;
  4. save results in an array;
    1. open the file name given by last array element ("pqr");
    2. write the array content to the file;
    3. close the file.
  5. repeat 2 until whole file is read;
  6. close the file.

Alternatively, if the last element of the lines being does not ever change, you would need to split the line only once and could open and close the file handle being written to outside of the loop, and read & write in consecutive statements.

Another variation could be is to save the file being read in a variable and write the value of that variable after everything has been read.

Replies are listed 'Best First'.
Re^2: need urgent help for
by talexb (Canon) on Jan 14, 2013 at 17:51 UTC

    OK -- now we're getting somewhere. What Perl code have you written to implement that algorithm?

    Alex / talexb / Toronto

    "Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

      parv isn't the OP. :P

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013208]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2018-07-22 07:03 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (452 votes). Check out past polls.