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

Re^3: Tie::File Write Problem

by jethro (Monsignor)
on Nov 17, 2011 at 23:35 UTC ( #938706=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Tie::File Write Problem
in thread Tie::File Write Problem

@tmp is a completely separate variable that is not tied to the file. The split copies the data. You would have to add the following inside the foreach-loop to change the file as you intented:

$i= join(',',@tmp);

Note that even this works only because $i actually is an alias to the data in @lines and not a copy (this is magic done by the foreach loop)

Replies are listed 'Best First'.
Re^4: Tie::File Write Problem
by packetstormer (Monk) on Nov 18, 2011 at 08:35 UTC

    Thanks - when I think it through it makes sense as to why it wasn't writing to the file!

    Rejoining the value back into the line works perfectly!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2016-08-26 01:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (364 votes). Check out past polls.