Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl
    
    ...
    
    close $outf;
    close $inf;
    
  2. or download this
    # file consisting of 50 0s
    perl -le 'foreach my $i ( 1 .. 50 ) { print q{0}; }' > file_0.txt
    
  3. or download this
    # file consisting of 50 1s
    perl -le 'foreach my $i ( 1 .. 50 ) { print q{1}; }' > file_1.txt
    
  4. or download this
    # file containing mix of 0s and 1s
    perl -le 'srand(); my $f = 0; foreach my $i ( 1 .. 50 ) { if ( $i % 5 
    +== 0 ) { $f++; $f %= 2; } print $f; }' > file_mix.txt
    
  5. or download this
    Character: 0 Count: 50
    
  6. or download this
    Character: 1 Count: 50
    
  7. or download this
    Character: 0 Count: 4
    Character: 1 Count: 5
    ...
    Character: 0 Count: 5
    Character: 1 Count: 5
    Character: 0 Count: 1