
Ndx
Novice
Jul 28, 2009, 11:42 AM
Post #18 of 22
(8350 views)
|
Thank You Guys, I'm crazzy or something is wrong ...
#!/usr/bin/perl use strict; use warnings; my %prefix = ( 1 => 'Test2!', 2 => 'Test3!', 3 => 'Test4!', 4 => 'Test5!', ); local $^I = "data2.bak"; # the backup extension local @ARGV = "data.txt"; # the file to edit while (<>) { print "$prefix{$.} $_" if exists $prefix{$.}; } Again it prints only in 1st line then stops. data.txt @• NanoVolt-Uno-Quad-Small: 324786 +345 @• NanoVolt-Uno-Quad-Small: 35436 +545 @• NanoVolt-Uno-Quad-Small: 8888.51 +145 @• NanoVolt-Uno-Quad-Small: 56445 +54 @• NanoVolt-Uno-Quad-Small: 56435 +1657 Whats funny ... If I create a file called a new data.txt Inside.. 28347298 893729873 87236478 783624876 78236476 738264678 32874888 283976489 It prints perfectly fine to this file!
(This post was edited by Ndx on Jul 28, 2009, 11:46 AM)
|