http://qs321.pair.com?node_id=1205570


in reply to parse html for specific things

Hi,

Yes, it really looks like JSON.

Try this:

use strict; use warnings; use JSON; use Data::Dumper; my $json = JSON->new->allow_nonref; my $json_text = do { local $/; <DATA> }; #read DATA Block my $ref = $json->decode( $json_text ); #get Perl Data Structure my %data = %{$ref->{data}->[0]}; #giving the shortcut a na +me my %buyQuantity = map { $_ =~ m/buyQuantity/ ? ($_, $data{$_}) : () } keys %data; # extract data you are looking for print Dumper(\%buyQuantity); #observe results __DATA__ {"futLink":"\/live_market\/dynaContent\/live_watch\/get_quote\/GetQuot +eFO.jsp?underlying=SHREECEM&instrument=FUTSTK&expiry=28DEC2017&type=- +&strike=-","otherSeries":["EQ"],"lastUpdateTime":"15-DEC-2017 14:55:5 +3","tradedDate":"15DEC2017","data":[{"extremeLossMargin":"5.00","cm_f +fm":"21,823.45","bcStartDate":"25-JUL-17","change":"-146.90","buyQuan +tity3":"3","sellPrice1":"17,751.40","buyQuantity4":"5","sellPrice2":" +17,758.50","priceBand":"No Band","buyQuantity1":"3","deliveryQuantity +":"93,925","buyQuantity2":"2","sellPrice5":"17,775.00","quantityTrade +d":"1,09,030","buyQuantity5":"2","sellPrice3":"17,772.10","sellPrice4 +":"17,772.15","open":"18,044.00","low52":"13,140.30","securityVar":"5 +.21","marketType":"N","pricebandupper":"19,688.10","totalTradedValue" +:"2,741.00","faceValue":"10.00","ndStartDate":"-","previousClose":"17 +,898.30","symbol":"SHREECEM","varMargin":"7.50","lastPrice":"17,751.4 +0","pChange":"-0.82","adhocMargin":"-","companyName":"Shree Cements L +imited","averagePrice":"17,850.84","secDate":"14DEC2017","series":"EQ +","isinCode":"INE070A01015","surv_indicator":"-","indexVar":"-","pric +ebandlower":"16,108.50","totalBuyQuantity":"7,050","high52":"20,538.0 +0","purpose":"DIVIDEND - RS 24 PER SHARE","cm_adj_low_dt":"23-DEC-16" +,"closePrice":"0.00","isExDateFlag":false,"recordDate":"-","cm_adj_hi +gh_dt":"15-MAY-17","totalSellQuantity":"7,255","dayHigh":"18,197.90", +"exDate":"21-JUL-17","sellQuantity5":"1","bcEndDate":"31-JUL-17","css +_status_desc":"Listed","ndEndDate":"-","sellQuantity2":"1","sellQuant +ity1":"1","buyPrice1":"17,750.25","sellQuantity4":"2","buyPrice2":"17 +,750.20","sellQuantity3":"2","applicableMargin":"12.50","buyPrice4":" +17,750.00","buyPrice3":"17,750.10","buyPrice5":"17,735.05","dayLow":" +17,701.00","deliveryToTradedQuantity":"86.15","basePrice":"17,898.30" +,"totalTradedVolume":"15,355"}],"optLink":"\/marketinfo\/sym_map\/sym +bolMapping.jsp?symbol=SHREECEM&instrument=-&date=-&segmentLink=17&sym +bolCount=2"}