#!/usr/bin/perl use strict; use warnings; use diagnostics; use Data::Dumper; my $html = '
'; my @data = (); while ( $html =~ m||g ) { push( @data, { link => $1, name => $2 } ); } print Dumper(\@data); #### result #### # $VAR1 = [ # { # 'link' => '/my-bloody-valentine-rxzg3.html', # 'name' => 'My Bloody Valentine' # }, # { # 'link' => '/my-bloody-valentine-lovely-sweet-darlene-9lgrnkb.html', # 'name' => 'Lovely Sweet Darlene *' # }, # { # 'link' => '/jennifer-love-hewitt-d193f.html', # 'name' => 'Jennifer Love Hewitt' # }, # { # 'link' => '/jennifer-love-hewitt-i-want-a-love-i-can-see-jv2mj67.html', # 'name' => 'I Want A Love I Can See *' # }, # { # 'link' => '/jennifer-love-hewitt-d193f.html', # 'name' => 'Jennifer Love Hewitt' # }, # { # 'link' => '/jennifer-love-hewitt-no-ordinary-love-4rftntr.html', # 'name' => 'No Ordinary Love *' # } # ]; #
ArtistSong
My Bloody ValentineLovely Sweet Darlene *
Jennifer Love HewittI Want A Love I Can See *
Jennifer Love HewittNo Ordinary Love *
([^<]+)