The txt files are not that large (about 1000 lines usually) What I want to achieve is this : get all occurrences of :

Orderbook ID: ID_ Symbol: xxxxx xxxxx ISIN: SExxxxxxxxx

and print it out like so : ID:ISIN:SYMBOL

for example : ID_:SExxxxxxxxxx:xxxxx xxxxx

This is what I've written now :

use strict; use warnings; use File::Basename; use Text::ParseWords; open (FILE, $ARGV[0]); sub getValue { $_ =~ s/\s//g; my ($name, $value) = split(/:/); chomp($value); return $value; } while (<FILE>) { my (@ID,@ISIN,@SYMBOL); if ($_ =~ m/ID:/) { @ID = getValue($_); } if ($_ =~ m/ISIN:/) { @ISIN = getValue($_); } if ($_ =~ m/Symbol:/) { @SYMBOL = getValue($_); } my @FULLVAR = (@ID,@ISIN,@SYMBOL); my $num = 0; my $count = 0; foreach (@ID,@ISIN,@SYMBOL) { printf "$_:"; } } } else { print "You need to specify an input file \n"; print "Usage : ".basename($0)." difffile.txt \n"; exit; }
Orderbook ID: XXX Symbol: DUMMY 00OXX ISIN: SE000123456 Market: Plain Dummy SE ## inactivationTime: [2012-01-01T00:00:00] => [2012-01-10T00:00:00] ## XML/Warrant/ReimbursementDay: [2012-01-06] => [2012-01-10] ## XML/Warrant/LastTradedDay: [2012-01-06] => [2012-01-10] ## unpublicationTime: [2012-01-01T00:00:00] => [2012-01-10T00:00:00
can everybody please change all of the log file data to the following DUMMY data? please! it's really important!!

In reply to 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.