 |
Linux Format forums Help, discussion, magazine feedback and more
|
| View previous topic :: View next topic |
| Author |
Message |
geek73666
Joined: Wed Mar 30, 2011 7:37 am Posts: 4
|
Posted: Wed Mar 30, 2011 7:41 am Post subject: Perl: how to delete line from file? |
|
|
I'm writing a simple Perl script, and want to delete a user specified line from a file. Can anyone help me?  |
|
| Back to top |
|
 |
geek73666
Joined: Wed Mar 30, 2011 7:37 am Posts: 4
|
Posted: Sat Apr 09, 2011 2:11 am Post subject: |
|
|
I know how now!!! Use tie::file and splice, like this:
| Code: |
use Tie::File;
tie @array, 'Tie::File', 'filename';
splice @array, 1,1;
|
That will delete the second line from the file filename seems obvious now...  |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|