halfcountplus has asked for the wisdom of the Perl Monks concerning the following question:
The files do get created. I tried IO::File to create the handle but it is the same deal; I've used scalars this way before so way not a hash element?#!/usr/bin/perl -w use strict; my %files; while (<DATA>) { $_=~/^(\w+): (\d) (\w+)/; unless ($files{$1}) { open $files{$1}, ">$1.tmp" || die "Couldn't +open $1.txt...\n"; } print $files{$1} "$2 $3\n"; # No dice! (syntax error) }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hash element as file handle
by jwkrahn (Abbot) on Mar 28, 2009 at 19:42 UTC | |
by halfcountplus (Hermit) on Mar 28, 2009 at 19:53 UTC | |
|
Re: hash element as file handle
by FunkyMonk (Bishop) on Mar 28, 2009 at 23:37 UTC | |
|
Re: hash element as file handle
by trwww (Priest) on Mar 29, 2009 at 18:43 UTC |