Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

steph_bow's scratchpad

by steph_bow (Pilgrim)
on Aug 16, 2007 at 08:36 UTC ( [id://632954]=scratchpad: print w/replies, xml ) Need Help??

Thanks alot dogz007

You are very nice

your explanations are very clear, and you explained to me in every details

Just a few words to turn your attention on the following point : -- is not magical, contrary to ++

So, instead of decrementing @two, I have incremented twice @one

So I had to make some little modifications to your proposition, which is already very good

#! /usr/bin/perl use strict; while (my $line = <DATA>) { chomp $line; my @line = split ";", $line; next if $line[0] eq $line[1]; next unless length $line[0] == length $line[1]; my @one = breakup($line[0]); my @two = breakup($line[1]); my $one_incremented; my @One_Incremented = @one; foreach $one_incremented(@One_Incremented){ ++$one_incremented; } next unless scalar(@one) == scalar(@two); print STDOUT "one vaut : @one and two vaut : @two\n"; my @match = map { $one[$_] eq ++$two[$_] || ++$One_Incremented[$_] + eq $two[$_] ? 1 : 0 } (0..$#one); print STDOUT "match vaut @match\n"; print $line, "\n" if 1 == grep {$_} @match; } sub breakup { my @out; while ($_[0]) { $_[0] =~ s/^([a-zA-z]|[0-9]+)//; push @out, $1; } return @out; }

interesting topics: 674374 How would I sort a two-dimensional array by multiple columns? (with excel)

679296 : Date sorting

#128077 : Module installation

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2024-03-29 15:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found