Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How to remove last character of a line

by Polyglot (Chaplain)
on Mar 23, 2021 at 03:03 UTC ( [id://11130169]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $line = '.abc(abc),';
    
  2. or download this
    chop $line;
    
  3. or download this
    $line =~ s/.$//;  #remove the last character before the newline
    $line =~ s/[A-Za-z]$//;  #remove an alphabetic character before the ne
    +wline
    $line =~ s/;$//;  #remove a semicolon at the end of the line
    $line =~ s/[ ]$//; #remove a single space at the end of the line
    $line =~ s/\s+$//;  #remove one or more whitespace characters at the e
    +nd of the line
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11130169]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-04-19 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found