actualize has asked for the wisdom of the Perl Monks concerning the following question:
Hey all. I got stuck on a quetion in "Intermediate Perl" by Randal L. Schwartz, brian d, foy & Tom Phoenix. So I went over the answer in the back.
I am pretty sure I understand how the problem is supposed to work but I don't quit understand why the code won't run on my machine. Can anyone enlighten me?
Code:#!/usr/bin/perl -w #distlog.pl use strict; use IO::File; my %output_handles; while (<>) { unless (/^(\S+):/) { warn "ignoring the line with missing name: $_"; next; } my $name = lc $1; my $handle = $output_handles{$name} ||= IO::File->open(">$name.info") || die "Cannot create $name.info: $!"; print $handle $_; }
Error: Can't use string ("IO::File") as a symbol ref while "strict refs" in u +se at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/IO/File.pm lin +e 188, <> line 1.
Thanks,
-Actualize
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Chapter 8 of intermediate perl
by ikegami (Patriarch) on Jun 26, 2008 at 02:19 UTC | |
by actualize (Monk) on Jun 26, 2008 at 03:23 UTC | |
by brian_d_foy (Abbot) on Jun 26, 2008 at 05:43 UTC | |
by actualize (Monk) on Jun 28, 2008 at 05:09 UTC | |
by ikegami (Patriarch) on Jun 26, 2008 at 04:43 UTC | |
Re: Chapter 8 of intermediate perl
by kyle (Abbot) on Jun 26, 2008 at 01:44 UTC |
Back to
Seekers of Perl Wisdom