Expected output:#!/usr/bin/env perl use 5.012; use LWP::Simple; use Data::Dumper; my @feeds = ( 'http://newyork.craigslist.org/search/fua?query=window%20fan&&format +=rss', 'http://newyork.craigslist.org/search/fua?sort=rel&query=wire+shelf& +format=rss' ); my (@search,@listings); my $s = 0; my $l = 1; my $u = 2; foreach my $feed (@feeds) { $_ = get $feed; die "Couldn't download $feed" unless defined; $search[$s] = [ m/<title>njdirector\\w+\s\|\s(.+?)<\/title>/g ]; $search[$s][$l] = [ m/<title><\!\[CDATA\[(.+?)\]\]><\/title>/g ]; $search[$s][$l][$u] = [ m/<link>(http:\/\/newyork.craigslist.org\ +/.+?)<\/link>/g ]; $s++; $l++; $u++; } say search; say Dumper \@search;
Current output:[ 'furniture search "wire shelf"', [ 'Moving - rugs-bike-art-ikea-barstools (Williamsburg) $50', [ 'http://newyork.craigslist.org/brk/fuo/5118292497.html', ] ] ]
$VAR1 = [ [ 'furniture search "window fan"', [ 'West Elm Parsons Square Table (Upper West Side) $ +;220', 'Moving - rugs-bike-art-ikea-barstools (Williamsburg) &# +x0024;50', [ 'http://newyork.craigslist.org/mnh/fuo/5122290773.html +', 'http://newyork.craigslist.org/brk/fuo/5118292497.html +', 'http://newyork.craigslist.org/que/fuo/5122167358.html +', 'http://newyork.craigslist.org/que/fuo/5121397241.html +', 'http://newyork.craigslist.org/que/fuo/5121521426.html +', 'http://newyork.craigslist.org/que/fuo/5121228197.html +', 'http://newyork.craigslist.org/que/fuo/5120454542.html +', 'http://newyork.craigslist.org/que/fuo/5120553519.html +', 'http://newyork.craigslist.org/wch/fuo/5120380233.html +', 'http://newyork.craigslist.org/brx/fud/5074875686.html +', 'http://newyork.craigslist.org/que/fuo/5119921410.html +', 'http://newyork.craigslist.org/mnh/fuo/5119643145.html +', 'http://newyork.craigslist.org/mnh/fuo/5119539455.html +', 'http://newyork.craigslist.org/mnh/fuo/5119482741.html +', 'http://newyork.craigslist.org/que/fuo/5119098116.html +', 'http://newyork.craigslist.org/que/fuo/5117747060.html +', 'http://newyork.craigslist.org/que/fuo/5116931245.html +', 'http://newyork.craigslist.org/que/fuo/5116011925.html +', 'http://newyork.craigslist.org/que/fuo/5115456123.html +', 'http://newyork.craigslist.org/que/fuo/5115029455.html +', 'http://newyork.craigslist.org/que/fuo/5113653309.html +', 'http://newyork.craigslist.org/que/fuo/5112399069.html +', 'http://newyork.craigslist.org/que/fuo/5111956635.html +', 'http://newyork.craigslist.org/mnh/fuo/5111276788.html +', 'http://newyork.craigslist.org/que/fuo/5110999938.html +' ], 'Dresser + AC unit for Sale-Both in Excellent Condition +(Astoria)', 'Table, Fan, Trash bin, Window blinds, Bed Frame, Twin M +attress (ELMHURST)', 'MOVING SALE - Dresser, AC Unit, TV (Astoria)', 'MOVING SALE - Dresser, AC Unit, TV (Astoria)', 'Table, Fan, Trash bin, Window blinds, Bed Frame, Twin M +attress (ELMHURST)', 'Carved Dining Room Chairs -wood (4) (Rye) $125', 'Handyman Furniture Assembly + Tv Mount & Shelves - +A/C (Manhattan Bronx Harlem Queens brooklyn) � 24;1', 'Table, Fan, Trash bin, Window blinds, Bed Frame, Twin M +attress (ELMHURST)', 'Black Iron Coat Rack (Upper West Side) $50', 'MOVE OUT SALE PICK UP ANYTIME TODAY!!! (Midtown East) & +#x0024;100', 'high quality ecru stationary, complete household furnit +ure set (Midtown East) $183', 'Table, Fan, Trash bin, Window blinds, Bed Frame, Twin M +attress (ELMHURST)', 'Table, Fan, Light, Trash bin, Window blinds, Bed Frame, + Twin Mattress (ELMHURST)', 'Table, Fan, Light, Trash bin, Window blinds, Bed Frame, + Twin Mattress (ELMHURST)', 'Table, Fan, Light, Trash bin, Window blinds, Bed Frame, + Twin Mattress (ELMHURST)', 'Table, Fan, Light, Grocery cart, Trash bin, Window blin +ds (ELMHURST)', 'Table, Fan, Light, Grocery cart, Trash bin, Window blin +ds (ELMHURST)', 'Bed Frame, Twin Mattress, Microwave, AC, Study Table, F +an, Light (ELMHURST)', 'Bed Frame, Twin Mattress, Microwave, AC, Table, Fan, Li +ght (ELMHURST)', 'Bed Frame, Twin Mattress, Microwave, AC, Table, Fan, Li +ght (New york city)', 'SofaBed / Bed Frames / Curtains / Dresser / Fan / Windo +w Shades (Midtown East) $10', 'Bed Frame, Twin Mattress, Microwave, AC, Table, Fan, Li +ght (Elmhurst)' ] ], [ 'furniture search "wire shelf"', undef, [ 'Moving - rugs-bike-art-ikea-barstools (Williamsburg) &# +x0024;50', 'Ethan Allen Media Center (Forest Hills) $2900', 'Metal Wire Rack (Murray Hill) $15', [ 'http://newyork.craigslist.org/brk/fuo/5118292497.html +', 'http://newyork.craigslist.org/que/fuo/5122101733.html +', 'http://newyork.craigslist.org/mnh/fuo/5121901736.html +', 'http://newyork.craigslist.org/mnh/fuo/5121610909.html +', 'http://newyork.craigslist.org/brk/fuo/5121582440.html +', 'http://newyork.craigslist.org/fct/fuo/5108510077.html +', 'http://newyork.craigslist.org/fct/fuo/5114664267.html +', 'http://newyork.craigslist.org/mnh/fuo/5120558162.html +', 'http://newyork.craigslist.org/mnh/fuo/5110714008.html +', 'http://newyork.craigslist.org/jsy/fuo/5113964211.html +', 'http://newyork.craigslist.org/lgi/fuo/5119989644.html +', 'http://newyork.craigslist.org/jsy/fuo/5119396119.html +', 'http://newyork.craigslist.org/mnh/fuo/5101671234.html +', 'http://newyork.craigslist.org/wch/fuo/5104111597.html +', 'http://newyork.craigslist.org/mnh/fud/5114135009.html +', 'http://newyork.craigslist.org/brk/fuo/5118718185.html +', 'http://newyork.craigslist.org/mnh/fuo/5118701467.html +', 'http://newyork.craigslist.org/mnh/fuo/5118465075.html +', 'http://newyork.craigslist.org/que/fuo/5107986299.html +', 'http://newyork.craigslist.org/que/fuo/5117445116.html +', 'http://newyork.craigslist.org/brk/fuo/5093360327.html +', 'http://newyork.craigslist.org/brk/fuo/5106235500.html +', 'http://newyork.craigslist.org/mnh/fuo/5095039134.html +', 'http://newyork.craigslist.org/mnh/fuo/5094808060.html +', 'http://newyork.craigslist.org/brk/fuo/5100382731.html +' ], 'Closet Maid Shelf Track Wardrobe (Bushwick) $80' +, 'ETHAN ALLEN ROBINSON TV MEDIA CENTER BOOKCASE *** (STAM +FORD, CT) $3595', 'JUST REDUCED! Lillian August Reclaimed Wood Primitive +Storage Cabinet (Wilton) $325', 'Omega Chrome Wire Shelf Truck (Flatiron) $50', 'Beautiful Pottery Barn Lyla Bar (Harlem / Morningside) +$450', 'Wire Shelving with adjustable shelves (Jersey City) &#x +0024;60', 'SCROLL HEADBOARD - NEW IN BOX (Farmingdale) $50' +, 'RARE 300cm Pax DISCONTINUED Stordal Sliding Doors Wardr +obe / Room Divi $650', '4-tier standing shelf **Excellent Condition (Upper East + Side) $25', 'Cheap Mirrored Ikea Wardrobes- $150 (Scarsdale) $ +;150', '4 assorted bookcases, $15 & up (East Village)', 'TV Stand (Williamsburg) $60', 'Industrial wire Shelf (Gramercy) $60', 'Heavy Duty Wire Shelving Unit (Gramercy) $50', 'Ethan Allen Media Center (Forest Hills) $2900', '4 Tier/Shelf Metal Shoe Rack/Shelving Unit Storage Orga +nizer (Elmhurst) $15', 'used 6 shelf plastic container - $10 (Bensonhurst) ((Be +nsonhurst)) $10', '1575 vintage FISHER PRICE CONTRUX mixed Lot Parts � +24;150', '3 - Tier Vintage Storage Shelf (Upper East Side)  +4;40', 'Black Sturdy 2-tier INTERMETRO Shelf (Upper East Side) + $50', 'Black wire shelf 6ft x 3ft x 14in $35' ] ] ];
In reply to Parse HTML into multidimensional array by mazdajai
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |