use URI qw( ); my @segments = URI->new($url)->path_segments(); utf8::decode($_) for @segments;