Hi can you help please - i'm just having trouble mapping two group of entries.
My input file, has five teams with two group for each team (seperated by "/". I want to map if a member of a team, say Team1, from the first group (left side) is also present in any other team of the second group (right side), then i want to map the two teams. i.e. Joe is in Team1 and Team2, so map these together, but if a team member is found in only one side of the team is left unmaped. Please see input and the expect output below.
INPUTFILE Team1=Joe / Phil , Amenda Team2=James / Pam, Joe Team3=Carmen , Lisa / James Team4=Don , Phil / Carmen Team5=Uri , Kate / Don ------------------------ Expected OUTPUT Don IS IN Team5 AND Team4 Phil IS IN Team4 AND Team1 Carmen IS IN Team4 AND Team3 James IS IN Team3 AND Team2 Joe IS IN Team2 AND Team1
Here is my code, as you can see i'm not getting the correct mapping. even if i add the 'if statment' i can't seem to get the correct mapping
use Data::Dumper; open (my $infile, "<", "teamInput.txt") || die $!; while (defined(my $line = <$infile>)) { chomp $line; my @team = split /=/, $line; my ($a, $b) = split /\//, $team[1]; #member in group 1 and 2 split by + '/' my @x = split /\,/, $a; my @y = split /\,/, $b; my @results; for my $x1(@x) { for my $y1(@y){ #if ($x1 eq $y1){ push @results, [$team[0],$x1, $y1]; } } print join("\n", map { $_->[1] "$_->[0] AND $_->[0]" } @results), +"\n"; #print Dumper(\@results); } #}
Thank you for your time
In reply to Matching problem by jo26
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |