HI all,
In PERL, I want to know which is best practice among the two methods to write TWO IF conditions.
In first method both conditions are evaluated every time $iop is fetched. but in the second method the second condition ($iop =~ /nop/) is evaluated only if First condition is satisfied ( Am i right? ). Wont the 2nd method save some time or is it not the best practice for large <TST> files?
OR Does the best practice means writing the code in very few lines which is simple to read & maintain.
First method:
open (TST, '<c0.ex4.t0.tst');
abc: while ( $iop = <TST>)
{
if( ( $iop =~ /$ra/ ) && ($iop =~ /nop/) )
{
print "$iop \n"; last abc;
}
}
second method:
open (TST, '<c0.ex4.t0.tst');
abc: while ( $iop = <TST>)
{
if( $iop =~ /$ra/ )
{
if ($iop =~ /nop/)
{
print "$iop \n"; last abc;
}
}
}