in reply to Re: Match a chunk
in thread Match a chunk
The above code works, except that when it gets to table column $lin = LakeO it matches all the members in updateloc1, so my struggle has been to make $lin match $update exactly to the forward slash. Well, after re-arranging the loops, the solution is simple: $update =~ /$lin\//. Should have taken a break much sooner.#!/usr/bin/perl -w use strict; my @updateloc1 = ("LakeOsouth/stuf", "LakeOeast/stuf", "LakeO2/stuf", +"LakeO/stuf"); my @texlines = ("LakeOsouth", "LakeOeast", "LakeO2", "LakeO"); for my $lin (@texlines){ for my $update (@updateloc1){ if ($update =~ /$lin/){ print "The table column $lin matches the directory name $u +pdate, so now do stuf in the subdir\n"; } } }
|
|---|