in reply to Re: Re: Redefining chomp()
in thread Redefining chomp()

Wouldn't this be a good place to use local? Something like
{ local $/ = "\n\r"; chomp; }
protect the global state of $/ and let you deal with changing it's behavior right before the chomp. The scope could be increased until you've captured all of your chomp calls. Any new chomps you write, unless they're in the same scope as the local call would use the default value of $/
code is untested.

Replies are listed 'Best First'.
Re: Re: Re: Re: Redefining chomp()
by biosysadmin (Deacon) on Mar 24, 2004 at 17:49 UTC
    If he doesn't want to search the entire code to replace calls to chomp, it's likely that he wouldn't want to locally redefine $/ by putting blocks around each chomp statement.