I did find a way around this problem, though, by using 'select'.
use strict;
use FileCache;
my $a01;
$a01 = 'a01file';
cacheout $a01;
select $a01;
print "XYZ\n";
Check out
perldoc -f select
for more info on select.
It may not be the best solution but it will get around the error.
Dan
Dan Brown wrote:
>
> I'm sorry, strike that. I had the 'use strict' commented out when
> testing with 5.6.1. Perl 5.6.1 gives the same warning.
>
> Dan Brown wrote:
> >
> > Johnathan evidently didn't see the cacheout (as I didn't).
> >
> > I assume you are using a perl version prior to 5.6.1. I have both 5.005
> > and 5.6.1 installed. The code works with 5.6.1 but gives the error you
> > see when using 5.005.
> >
> > Other than upgrading to 5.6.1 (maybe 5.6.0 works fine too), I'm at a
> > loss at this point as to what to suggest. Perhaps a hunt through the
> > perl docs as to what's different between Perl 5.0 and 5.6 would get you
> > going.
> >
> > Dan
> >
> > "Cron, Daniel" wrote:
> > >
> > > Thanks!
> > >
> > > I'm not sure I understand, though.
> > >
> > > I'm trying to write to file 'a01file' which is represented by file handle
> > > $a01.
> > > The info I'm trying to write is "XYZ\n".
> > >
> > > I think your solution writes to standard out, not file a01file.
> > > I'm probably still missing something.
> > >
> > > Thanks again!
> > >
> > > -----Original Message-----
> > > From: Johnathan Kupferer [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, April 30, 2001 4:34 PM
> > > To: Cron, Daniel
> > > Cc: '[EMAIL PROTECTED]'
> > > Subject: Re: FileCache - use strict
> > >
> > > The error is a bit misleading. The problem is you need an
> > > operator
> > > between $ao1 and "XYZ\n". Try:
> > >
> > > print $a01, "XYZ\n";
> > >
> > > or
> > >
> > > print $a01 . "XYZ\n";
> > >
> > > This should clear things up. I don't know whay perl is
> > > trying to do with it if you don't "use strict"...
> > >
> > > - Johnathan
> > >
> > > >
> > > > How can I fix this so it will work with "use strict;"?
> > > > (The program is really a few hundred lines long and
> > > growing. I find having
> > > > "use strict;" on helps me catch a lot of bugs during
> > > development.)
> > > >
> > > > #!/opt/local/bin/perl -w
> > > > use strict;
> > > > use FileCache;
> > > > my $a01;
> > > > $a01 = 'a01file';
> > > > cacheout $a01;
> > > > print $a01 "XYZ\n";
> > > >
> > > >