Thanks a lot man, It's working fine.
Just one more thing. Now, when I am printing out those lines, I need to use values from my array. I have a subroutine in which I am parsing values from a text file and the values are stored in an array, so can I just call a subroutine and use array reference to print out my text with the values from that array ?
Because when I am doing that It's giving me this error
Global symbol "$one_ref" requires explicit package name at testfile.pl
+ line 12.