[ale] Perl Help split stopped working recently

DJPfulio at jdpfu.com DJPfulio at jdpfu.com
Thu Dec 1 12:11:33 EST 2022


I have this complete, simple, perl program ...

==
#!/usr/bin/env perl
   
use strict;
use warnings;
use utf8;

my $start_time = "";
my $stop_time = "";

while (<>){
  chomp;
  my $line = $_;

   ( $start_time, $stop_time ) = split( / - /, $line, 2);

    print "Line: $line\n \t $start_time, $stop_time\n";
}
==

And I feed it this input file:

==
   5:00 AM - 6:00 AM Live
   6:00 AM - 7:00 AM New
==

This pattern for split is something I've used for over 25 yrs and 2 weeks ago, it was working as expected.  Today, it doesn't work.  The $stop_time isn't being set.  split() ain't workin'.  The $start_time ends up with a copy of the line.

Tried with perl v5.30 and v5.33 on 2 different systems. Same results.

I expect the start to be "  5:00 AM" and the stop to be "6:00 AM Live" for the first input after the split().

Any ideas?  I'm assuming it is something dumb, but for something this simple, I'm just missing it.


More information about the Ale mailing list