Help for this page

Select Code to Download


  1. or download this
    while (<DATA>) {
       ($first) = $_ =~ m/^(\S+)/;
    ...
      Here's a line.
    
    Line five is this one.
    
  2. or download this
    while (<DATA>) {
        $first = (split/\s/)[0];
        print "$first\n";
    }
    
  3. or download this
    while (<DATA>) {
        $first = substr $_, 0, index $_, " ";
        print "$first\n";
    }