Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

How to match last character of string, even if it happens to be a newline?

by Allasso (Monk)
on May 12, 2019 at 14:36 UTC ( #1233644=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    print('String: a\nb\nc\n' . "\n");
    my $text_1 = "a\nb\nc\n";
    ...
    print("----------\n>" . $1 . "<\n");
    $text_1 =~ m@(\n|.)$@sm;
    print("----------\n>" . $1 . "<\n");
    
  2. or download this
    String: a\nb\nc\n
    ----------
    ...
    <
    ----------
    >a<
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1233644]
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2019-06-24 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (100 votes). Check out past polls.

    Notices?