tobold.org

correct • elegant • free

△ comp.lang.perl △

◅ doing efficient "ls" from within perl script

perl does not complain about missing ';' ▻

Why does tr/A-Z/a-z/ work?

In article <chrisw.365.000DD910@leland.stanford.edu>,
Chris Wilkins <chrisw@leland.stanford.edu> wrote:
>I was wondering if someone could explain to me exactly why hyphens in
>translation statements are taken to imply ranges rather than literal
>hyphens?

'Cos that's how tr is defined to work; it is similar to the Unix
tr(1) command.

>Is this an instance of some general rule, or is it something specific
>to the tr operator?

It's specific to tr.  Character ranges may also be used in character
classes in regular expressions; I can't think of anywhere else.

Tim.
--
Tim Goodwin   | "Those who will not study history are
Cambridge, UK | doomed to debug it." -- Barry Shein

Original headers:

From: tim@pipex.net (Tim Goodwin)
Newsgroups: comp.lang.perl.misc
Subject: Re: Why does tr/A-Z/a-z/ work?
Date: 18 Mar 1996 17:53:08 GMT
Organization: Unipalm PIPEX
Message-ID: <4ik7u4$4fn@wave.news.pipex.net>
References: <chrisw.365.000DD910@leland.stanford.edu>

△ comp.lang.perl △

◅ doing efficient "ls" from within perl script

perl does not complain about missing ';' ▻