On Jul 13, Goncalves, Jorge (Ext) said:
>print "\n$DCICLIENTDIR\\logicalPMF.exe -f
>$DCICLIENTDIR\\config$NOM_PMF.cfg\n";
> print ($_);
>my $var1="$DCICLIENTDIR\\logicalPMF.exe -f
>$DCICLIENTDIR\\config$NOM_PMF.cfg\n";
> my $line=($_);
> if ($_ =~ m /$var1/)
> {
> $Ajout=0;
> }
>D:\muse\lotus\notes\logicalPMF.exe -f D:\muse\lotus\notes\config.cfg
>D:\muse\lotus\notes\logicalPMF.exe -f D:\muse\lotus\notes\config.cfg
>-pmfType Logical -id
>
>$Ajout=1 always. the if never match the patern $var1.
That is because $var1 contains backslashes, which are interfering with its
use as a regex. Long story short, you should either do:
if ($_ eq $var1) { ... }
if you want to test for EQUALITY, or
if ($_ =~ /\Q$var1/) { ... }
# or
if (index($_, $var1) > -1) { ... }
to test if $var1 is contained SOMEWHERE in $_.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>