thank you for your reply ... Yes that would be the proper way of doing it, you are absolutely right and I will look into it. For now , here is a quick and dirty solution that solved it for me:

use strict; use warnings; use File::Basename; use Text::ParseWords; if ($#ARGV == 0) { open my $file_in, "<", $ARGV[0] or die "Couldn't open file '$A +RGV[0]': $! \nDid you specify a valid file?"; # open up a new file to write the changes made to open my $file_out, ">", "$ARGV[0].new" or die "Can't write new fil +e '$ARGV[0].new' : $! \nDo you have write permissions?"; # these are our currently active market makers my @list=("BNP","CBK","CIT","NDS","OHD","OHM","RBN","RBS","SEK","S +GA"); while (<$file_in>) { ## write all changes to new file print $file_out $_; # if we find a match for any Symbols if ($_ =~ m%</Name><Symbol>([^<]+)%) { my $SYMBOL; my $MATCH; $SYMBOL = $1; # and the $SYMBOL matches the array @list for active market ma +kers if (grep {$_ eq $SYMBOL} @list) { # Print and add the line marketMakerOrganization: $SYMBOL to t +he $file_out print $file_out "\t\tmarketMakerOrganization:\"$SYMBOL +\",\n"; } } } } else { print "You need to specify an input file \n"; print "\n"; print "They are usually located here : \n"; print "/PATH/orderbooks-xx-hostname-yy.x.xxx.xx.js"; print "\n"; print "Usage : ".basename($0)." difffile.txt \n"; print "\n"; exit; }

In reply to Re^2: get string between two < tags > in .js file (xml) by kamchez
in thread get string between two < tags > in .js file (xml) 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.