Hi,
I am VERY new to perl and I'm not sure if this is the correct place to send
duncy type questions ( if not where ) but here goes..
Why does the print not work in example 1 but work in 2
1)
FILE:
while( $filename = <LISTOFFILES> )
{
$filename =~ /\.c$/ && print $filename && next FILE;
}
2)
FILE:
while( $filename = <LISTOFFILES> )
{
if( $filename =~ /\.c$/ )
{
print $filename;
next FILE;
}
}
The reason for the next is because there is more to the while statement
which I won't want to do if the condition is met.
Thanks
Simon....
NB: Running on an RS6000 ( AIX V3.2.5 )
I am VERY new to perl and I'm not sure if this is the correct place to send
duncy type questions ( if not where ) but here goes..
Why does the print not work in example 1 but work in 2
1)
FILE:
while( $filename = <LISTOFFILES> )
{
$filename =~ /\.c$/ && print $filename && next FILE;
}
2)
FILE:
while( $filename = <LISTOFFILES> )
{
if( $filename =~ /\.c$/ )
{
print $filename;
next FILE;
}
}
The reason for the next is because there is more to the while statement
which I won't want to do if the condition is met.
Thanks
Simon....
NB: Running on an RS6000 ( AIX V3.2.5 )