Help for this page

Select Code to Download


  1. or download this
    $ perl -wnle 'push @x, $_; if(@x>=2) {print "@x"; shift @x}' input.txt
    Hello I
    ...
    $ perl -wnle 'push @x, $_; if(@x>=3) {print "@x"; shift @x}' input.txt
    Hello I am
    I am happy
    
  2. or download this
    #!/usr/bin/env perl
    use warnings;
    ...
    for my $i (0..@array-$WINSIZE) {
        print @array[$i..$i+$WINSIZE-1];
    }
    
  3. or download this
    $ perl window.pl input.txt 2
    Hello I
    I am
    am happy