Hi All, I need help on this one please.
I have a input file with the following data. The 7 times 000s i have added in the input file in order to start with 1808 as the eight element. which works ok. am sure there is a better way. now once i captre the 8th element ex: 1808, then 1810 so on in the list, i print the output. which works fine. similarly i need to capture the following 7 list of elements in the file and print it out with certain parameter. e.g the Required output ------------------------------------------ This is 1808 eigth element This is1809 This is 180A This is 180B This is 180C Thsi s 180D This is 180E This is 180F This is 1810 eigth element This is 1811 This is 1812 This is 1813 This is 1814 This is 1815 This is 1816 This is 1817 input.txt file 0000 0000 0000 0000 0000 0000 0000 1808 1809 180A 180B 180C 180D 180E 180F 1810 1811 1812 1813 1814 1815 1816 1817 #!/usr/bin/perl use strict; use warnings; my $filename; my $counter = 0; my $A; ######### FORM META ######################################################## # if the counter 4 the insert 3 times 000 into the file for correct start # if the counter 8 then insert 7 times 000 into the file for correct start $filename = "input.txt" ; open (FILE, "< $filename" ) or die "Could not open $filename: $!"; while (<FILE>) { chomp; $counter++; next unless ($counter == 8); $counter=0; # Of course you should not forget to reset your counter ;-) print "form meta from dev $_\; \n"; } ############################################################################## Any help on this would be much appreciated. Regards TM