I'm just learning Perl and can't figure out why this code does not work.
#!/usr/bin/env perl
use strict;
use warnings;
open(my $configfile, "<", 'PoliceLog.txt') or die "Could not read file\n";
my @configdata = split 'zz', $configfile;
print "$configdata[0]\n";
close $configfile;[/b]
I expect it to print the first line of the PoliceLog.txt file but instead I get this:
new-host-6erl bobgreen$ perl TestB.pl
GLOB(0x12280bc10)
new-host-6erl bobgreen$
#!/usr/bin/env perl
use strict;
use warnings;
open(my $configfile, "<", 'PoliceLog.txt') or die "Could not read file\n";
my @configdata = split 'zz', $configfile;
print "$configdata[0]\n";
close $configfile;[/b]
I expect it to print the first line of the PoliceLog.txt file but instead I get this:
new-host-6erl bobgreen$ perl TestB.pl
GLOB(0x12280bc10)
new-host-6erl bobgreen$