Perl version: 5.8.0
Redhat version: Red Hat 5.3
####
#!/usr/bin/perl
use warnings;
use strict;
use Switch;
file_version_1();
file_version_2();
sub file_version_1 {
open( my $fh, '<', '/tmp/test_file.txt' ) or die( "Error: $!" );
while( my $line = <$fh> ) {
print "$line\n";
}
close( $fh );
}
sub file_version_2 {
open ( FH, '/tmp/test_file.txt' ) or die ("Error: $!" );
while ( my $line = ) {
print $line;
}
close( FH );
}
sub test_switch {
my $id = shift;
switch( $id ) {
case 'add' { print 'aa' };
}
return 1;
}
##
##
GLOB(0x98dfbdc)
111
##
##
use Switch;
and
sub test_switch { ... }
##
##
111
111
##
##
$ perl -MO=Deparse test.pl
...
die "Error: $!" unless open my $fh, '<', '/tmp/test_file.txt';
use File::Glob ();
while (defined( my $line = glob( ' ' . $fh ))) {
print "$line\n";
}
close $fh