in reply to using s///g;

You can't open DATA directly like that, which is what the error message is telling you. Either change DATA to something else, or (preferably) switch to the three form method of opening files: open my $data, '<', 'Pull-2015-5-18-23.txt' or die 'failed to open file';

Replies are listed 'Best First'.
Re^2: using s///g;
by GrandFather (Saint) on Aug 06, 2015 at 21:02 UTC

    Did you run the OP's code? Did you test your assumption? Obviously not because:

    use strict; use warnings; my $filename = 'data.txt'; open DATA, '>', $filename or die "Can't create $filename: $!\n"; print DATA <<STUFF; Stuff written to disk using file handle DATA STUFF close DATA; open my $inFile, '<', 'data.txt' or die "Can't open $filename: $!\n"; print <$inFile>; close $inFile;

    Prints:

    Stuff written to disk using file handle DATA

    which would fail with the OP's error message if you were right. In fact I can't see how you get your implied error of "Can't use DATA in a file open statement" from 'Can't modify constant item in scalar assignment at date.pl line 1, near "10,"'.

    Premature optimization is the root of all job security