good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hi there. I was trying to run your script and found that the output files were empty. I tracked down the problem to Line 42: push(@lin, $2) if $_ =~ /(Volume Leaders;US;NASDAQ;AMEX;NYSE;)(Sym +bol;Name.*)/g;You need to get rid of the " +" in Sym +bol. edit: there is another on (although benign) in line 54: $vf =~ s/Symbol\|Name\|Last Trade\|Change\|Volume\|Related Info\|/SYMB +OL\|NAME\|LAST TRADE\|CHANGE\|VOLUME\|RELATED INFO\n/g;edit2: and another on line 57. This one screws up your regex:
To avoid these, you want to be careful to click the 'Download' link before copying code from PM, since lines that get wrapped get " +" added to the break. Regarding that regex I pointed out, I'd like to recommend an easier to write/read/maintain way of doing this: $vf =~ s/\|(\d{1,3})\.(\d{1,3})\|(\d{1,3})\:(\d{1,3})/\|$1\.$2 $3\:$4/g;However, I suspect that you meant to use the following since $3 and $4 are matching a time:
Since you are matching 1, 2, or 3 digits, instead of writing out each variation, you can specify a range using the curlies. Check out QUANTIFIERS for more info. In reply to Re: extracting from web and adding to csv file with their links
by frozenwithjoy
|
|