SPUG: Odd read only error in 5.6 but not before?

Chris Wilkes cwilkes at singingfish.com
Sun Apr 15 01:41:54 CDT 2001


This little program fails with a "modification of read-only
variable" error at the while(<FOO>) statement under 5.6 but not under
previous versions.

I can modify it to do a "foreach my $letter ..." and then send down
"compit($letter)" which then works.

Am I missing something here?

Chris

#!/usr/bin/perl -w

use strict;
foreach (qw(a.txt b.txt)) {
  compit($_);
}

sub compit {
  my $file = shift;
  open (FOO, $file) || die "Can't read file '$file'\n";
  while (<FOO>) {
     chomp;
  }
  close FOO;
}


Version of 5.6 that fails:
bash-2.03$ perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris

My linux box:



 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
  Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/





More information about the spug-list mailing list