Help for this page

Select Code to Download


  1. or download this
    .abc(abc),
    
  2. or download this
    chop($line);              # Best way. Removes the last character.
    $line =~ s/.\z//s;        # Works, but not as simple as 'chop': substi
    +tution.
    substr($line, -1,1,'');   # Works, but not as simple as 'chop': substr
    + with empty-string replacement.
    substr($line,-1,1) = '';  # Works, but not as simple as 'chop': substr
    + as an lvalue.
    
  3. or download this
    .abc(abc),\n
    
  4. or download this
    $line =~ s/.$//;
    
  5. or download this
    chomp $line;
    chop $line;
    
  6. or download this
    $line =~ s/.\n?$//;