Help for this page

Select Code to Download


  1. or download this
    $ sample 10 somelongfile.txt  ## to get 10 random lines
    
    $ some long command | sample 50 > mysample.txt
    
  2. or download this
    my $wanted = shift || 10;
    my @got;
    ...
    
    die "Not enough lines!\n" if @got < $wanted;
    print @got;