hi,

I rewrote your script altogther, changing all your wrongly use printf to print and then using "my" for all your arrays, using warnings and strict. I figured your get function was from LWP::Simple module.
And I got output. See below:

use strict; use warnings; use LWP::Simple; sub stockquotegetter { my @quotes; my $html = get("http://www.iex.nl/Koersen/Aandelen.aspx") or die "Couldn't fetch the stock quotes"; my(@url,@url1,@url2); foreach my $aandeel (@_) { @url = split( /Realtime koers $aandeel/, $html ); @url1 = split( /LastPrice"><span>/, $url[1] ); @url2 = split( /</, $url1[1] ); #$html =~ m{basevalues['11754LastPrice'] = ([\d,]+) ;}; #printf $_; #printf $sales_rank #$html =~ m{ '11754LastPrice'] = (.*?);}i; # extract destinati +on of link #$url = $1; print "$aandeel $url2[0]\n"; push( @quotes, $url2[0] ); } print @quotes; } print stockquotegetter( qw(Aegon Aperam ING ASML DSM Boskalis KPN Randstad PostNL TomTom)) +;
OUTPUT Aegon 4,08 Aperam 11,04 ING 5,65 ASML 45,91 DSM 37,85 Boskalis 26,82 KPN 6,73 Randstad 25,76 PostNL 2,90 TomTom 3,47 4,0811,045,6545,9137,8526,826,7325,762,903,471

Please, note that the reconstruction was based on several assumptions.
This is not the best re-write, you could get though. There are still several things, you could optimise.
Please, compare your code with mine and get the best of the two!
Please, forgive my assumptions if they were wrong. I was only trying to help blindly!! :)


In reply to Re: list pushing by 2teez
in thread list pushing by robertw

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.