use strict; use warnings; use JSON; use Data::Dumper; my $json = JSON->new->allow_nonref; my $json_text = do { local $/; }; #read DATA Block my $ref = $json->decode( $json_text ); #get Perl Data Structure my %data = %{$ref->{data}->[0]}; #giving the shortcut a name 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\/GetQuoteFO.jsp?underlying=SHREECEM&instrument=FUTSTK&expiry=28DEC2017&type=-&strike=-","otherSeries":["EQ"],"lastUpdateTime":"15-DEC-2017 14:55:53","tradedDate":"15DEC2017","data":[{"extremeLossMargin":"5.00","cm_ffm":"21,823.45","bcStartDate":"25-JUL-17","change":"-146.90","buyQuantity3":"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","quantityTraded":"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.40","pChange":"-0.82","adhocMargin":"-","companyName":"Shree Cements Limited","averagePrice":"17,850.84","secDate":"14DEC2017","series":"EQ","isinCode":"INE070A01015","surv_indicator":"-","indexVar":"-","pricebandlower":"16,108.50","totalBuyQuantity":"7,050","high52":"20,538.00","purpose":"DIVIDEND - RS 24 PER SHARE","cm_adj_low_dt":"23-DEC-16","closePrice":"0.00","isExDateFlag":false,"recordDate":"-","cm_adj_high_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","sellQuantity1":"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\/symbolMapping.jsp?symbol=SHREECEM&instrument=-&date=-&segmentLink=17&symbolCount=2"}