I feel like I'm losing my mind on this.
Why would perl do this?


This script:


#!/bin/env perl

use warnings;
use strict;
use Data::Dumper;


my $block=<<'BLOCK';

alpha
bravo


charlie
delta



BLOCK
;

print "block is:vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv\n";
print $block;
print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n";

my @lines = split(/\n/, $block);

print "when I split on \\n, I get this:\n";
print Dumper \@lines;





OUTPUT OF SCRIPT IS:

block is:vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

alpha
bravo


charlie
delta



^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
when I split on \n, I get this:
$VAR1 = [
          '',
          'alpha',
          'bravo',
          '',
          '',
          'charlie',
          'delta'      <======== SHOULD BE SOME BLANK ENTRIES AFTER DELTA
        ];

_______________________________________________
Boston-pm mailing list
[email protected]
https://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to