Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Should chomping a constant always raise an error?

by Anonymous Monk
on Mar 14, 2005 at 11:53 UTC ( #439235=note: print w/replies, xml ) Need Help??


in reply to Re^2: Should chomping a constant always raise an error?
in thread Should chomping a constant always raise an error?

Oddly enough, if you use the Readonly module to mark your variable readonly, chomping will only fail if the variable is actually tried to be modified:
#!/usr/bin/perl use strict; use warnings; use Readonly; Readonly my $msg1 => "Hello, world"; Readonly my $msg2 => "Hello, world\n"; chomp $msg1; # line 11 chomp $msg2; # line 12 __END__ Modification of a read-only value attempted at /tmp/ro line 12

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-21 00:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (76 votes). Check out past polls.

    Notices?