sub splitTypeId { my ( $arg ) = @_; my ( $type, $id ); if ( $arg =~ m/ \A (\w) (\d+) \z /xms ) { $type = $1; $id = $2; } else { croak "Invalid format ($arg)\n"; } state %map = ( n => 'node', w => 'way', r => 'relation', ); if ( !exists $map{$type} ) { croak "Type ($type) is invalid\n"; } return $map{$type}, $id; }