in reply to Re: Comparison by position and value
in thread Comparison by position and value
That doesn't work as is?
#! perl -slw use strict; sub compatible { my ($s1, $s2) = @_; y/_/\0/c for $s1, $s2; !(($s1 | $s2)=~y/\0//); } printf "%s v %s ? %s\n", @$_, compatible( @$_ ) ? 1 : 0 for [ qw[ _8__3__19 48____7__ ] ], # good [ qw[ _8__3__19 4_8___7__ ] ], # bad [ qw[ _8__3__19 48_____7_ ] ]; # bad __END__ [11:18:29.65] P:\test>test _8__3__19 v 48____7__ ? 0 _8__3__19 v 4_8___7__ ? 1 _8__3__19 v 48_____7_ ? 0
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Comparison by position and value
by ambrus (Abbot) on Jan 02, 2005 at 11:25 UTC | |
by BrowserUk (Patriarch) on Jan 02, 2005 at 11:28 UTC |