#!/usr/bin/perl -w use strict; use Test::More qw(no_plan); while( ) { my( $input, $expected)= m{^'(.*?)'\s*=>\s*'(.*?)'}; (my $trimmed= $input)=~ s{(\\.)?\s*$}{defined $1 ? $1 : ''}e; is( $trimmed, $expected, "'$input'"); } __DATA__ 't' =>'t' 't ' =>'t' 't\ ' =>'t\ ' 't\ ' =>'t\ ' 't\ \ '=>'t\ \ '