Help for this page

Select Code to Download


  1. or download this
    my $sentence="to baah or not to chomp, that's the question";
    
    my $garbage = 0;
    $garbage++ while ($sentence =~ /[,'\s]/g);
    @chars = split //, $sentence;
    print "You can create ", (scalar(@chars) - $garbage)/4.0," groups of f
    +our characters here\n";
    
  2. or download this
    @chars = grep {!/(,|'|\s)/} @chars;
    my $n = 0;
    while ($n < $#chars){
      print $chars[$n],$chars[$n+1],$chars[$n+2],$chars[$n+3],"\n";
      $n = $n+4}