Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!rbj From: rbj@uunet.UU.NET (Root Boy Jim) Newsgroups: comp.lang.perl Subject: Re: First impressions of new perl user (code, questions, ...) Message-ID: <126310@uunet.UU.NET> Date: 22 Mar 91 22:28:03 GMT References: Organization: UUNET Communications Services, Falls Church, VA Lines: 56 In article mayer@sono.uucp (Ronald &) writes: ? I'm trying to make a perl script which will convert strings into ? case-insensitive regular expressions for sed [don't ask why :-(] ? for example: "$include (asdf)" gets converted into: ? "$[iI][nN][cC][lL][uU][dD][eE] ([aA][sS][dD][fF])" ? The only way I was able to do this in sed was to use one line for ? each character: /[aA]/s//[aA]/g ..... If I wanted to do case insensitive matching, I would first translate both my pattern and string into lower case, then do regular matching. Sed can do this. Use y/A-Z/a-z/. Actually I think you have to spell out the whole string. ?============================ ?A question (or request for a new feature): ? ?Is there any function which will show all my defined variables (and/or ?subroutins and/or open files). I'm not sure it's really useful, but I ?was thinking an interesting interactive perl application would be a ?calculator which would convert algebraic input into perl-commands and ?eval them. Is this practical? Trying to set this up I wanted a ?function to show all defined variables. There is a way to get your defined variables. Look at dumpvar.pl. As for opened files, keep track of them yourself. ?============================ ?A random idea (not really a request; just something I was thinking about): ? ?In the unpack function do "A" and "a" mean the same thing? Obviously not. ?If not, are the differences documented (not in my man page). To be honest, I couldn't quote you the exact differences, chapter and verse. I don't care. I will figure it out when I need to, and you should do the same. Hey kids, it's time to play, "Ask the Computer". ?============================ ?perl examples source question: ? ?I notice that "The code examples contained [in the Camel book] are ?available via anonymous FTP from uunet.uu.net in ?nutshell/perl/perl.tar.Z for your retrieval." Are they also available ?through uucp? Yes. More precisely, they live in ~ftp/nutshell/perl/perl.tar.Z. This is true whether anonymous or not, FTP or UUCP. We do support anonymous UUCP, but it costs you 40 cents per minute. Please do your FTP's during *DAYTIME* hours when our load is low. -- [rbj@uunet 1] stty sane unknown mode: sane