Thank you all for taking the time to help me out! It's truly amazing how many ways there are to do something ;) I've learned a lot by reading your replies and I've cleaned up the code a little and tweaked it with the input I got from each of you. here it goes;

use strict; use warnings; use File::Basename; use Text::ParseWords; if ($#ARGV == 0) { open my $file, "<", $ARGV[0] or die "Couldn't open file '$ARGV +[0]': $! \nDid you specify a valid file?"; my ($ID,$ISIN,$SYMBOL); while (<$file>) { if ($_ =~ m/ID:/) { $ID = getValue($_); } if ($_ =~ m/Symbol:/) { $SYMBOL = getValue($_); } if ($_ =~ m/ISIN:/) { $ISIN = getValue($_); print "$ID:$ISIN:$SYMBOL\n"; } } } else { print "You need to specify an input file \n"; print "Usage : ".basename($0)." difffile.txt \n"; exit; } sub getValue { $_ =~ s/\s+//g; my ($name, $value) = split(/:/); chomp($value); return $value; }

please let me know if there are any more improvements that can be done to make it more "clean" and "proper" according to "proper coding standards" ;9 Thank you all !!

Output from diff_file, running :
./isin_parse.pm diff_20120614T1442.txt
QYP:SE0001234567:LUP2L80OHM NGA:SE0001234567:SHB2K260OHM NJQ:SE0001234567:TRE2K70OHM NH0:SE0001234567:SKF3A190OHM NEY:SE0001234567:NOK3A70OHM QUA:SE0001234567:MINILONGLUPFO QPC:SE0001234567:MINISHRTOMXOO QP3:SE0001234567:MINISHRTOMXFO QU9:SE0001234567:MINILONGLUPEO P3B:SE0001234567:SWM2K240OHM P0N:SE0001234567:ASS3A160OHM NGF:SE0001234567:SHB3A260OHM R1B:SE0001234567:SKF2K210OHM QP8:SE0001234567:MINISHRTOMXKO R1K:SE0001234567:TEL3A123OHM P34:SE0001234567:SWE2K140OHM NAS:SE0001234567:ASS2K180OHM NC3:SE0001234567:BOL3A150OHM NDD:SE0001234567:HM2L280OHM NCX:SE0001234567:ERI3A120OHM P2D:SE0001234567:OXS3A1300OHM QNA:SE0001234567:MINILONGABBCO NGV:SE0001234567:SKF2K190OHM QPE:SE0001234567:MINISHRTOMXQO QU7:SE0001234567:MINILONGLUPCO
nt!!

In reply to Re: matching strings into array from txtfile and printing on same line by kamchez
in thread matching strings into array from txtfile and printing on same line by kamchez

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.