H
hou
Hello, everyone
I am reading the "Beginning Perl" written by Simon Cozen.
In chapter 6, he gave an example as following.
------------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
open FILE, "gettysburg.txt" or die $!;
my @speech = <FILE>;
print "Last five lines:\n", @speech[-5 ... -1];
------------------------------------------------
I thought the [-5...-1] was a typo. It's supposed to be [-5..-1].
So, I tried to use "three dots". It turns out that three dots work.
Now, I am confused. Could anyone please tell what "three dots" means
in perl?
Thank you very much
Dean
I am reading the "Beginning Perl" written by Simon Cozen.
In chapter 6, he gave an example as following.
------------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;
open FILE, "gettysburg.txt" or die $!;
my @speech = <FILE>;
print "Last five lines:\n", @speech[-5 ... -1];
------------------------------------------------
I thought the [-5...-1] was a typo. It's supposed to be [-5..-1].
So, I tried to use "three dots". It turns out that three dots work.
Now, I am confused. Could anyone please tell what "three dots" means
in perl?
Thank you very much
Dean