Re: Case conversions

2003-08-15 Thread Elias Assmann
On Fri, Aug 15, 2003 at 02:20:19PM -0700, Scott Taylor wrote: > > Any one have or know of a function to convert ugly "NAME, USER" to "User > Name"? $ perl -le '$_ = "NAME"; s/(.)(.*)/$1\L$2/; print' Name The function to convert a string to lower case is "lc". HTH, Elias -- If you ta

[OT] Re: Why is $_ being change.

2003-07-11 Thread Elias Assmann
On Thu, Jul 10, 2003 at 08:39:05PM -0700, [EMAIL PROTECTED] wrote: > > Geez, is that your real name? Yes, it is. However, where I live, few people find it remarkable. If I ever felt bad about it, maybe laughing a bit about Johnny Depp's name would cheer me up ("Depp" means "idiot" in German

Re: Why is $_ being change.

2003-07-10 Thread Elias Assmann
On Thu, Jul 10, 2003 at 12:28:17PM -0400, Paul Kraus wrote: > That did correct the problem. I don't understand what local $_; did. > So a while loop will change $_ if it is inside a foreach loop since both > use $_? Read M.J. Dominus' "Coping with Scoping", available at http://perl.plover.com/FAQ

Re: Unix diff in perl

2003-06-05 Thread Elias Assmann
On Thu, Jun 05, 2003 at 02:56:01PM +0530, [EMAIL PROTECTED] wrote: > >Is there a perl function/module that will help me calculate the difference > > >between two files? > >Something like the diff Unix command. > > There is a perl module which can do the same. > > Check out http://search.cpan.or

Re: minor regex brain fart

2003-04-02 Thread Elias Assmann
On Wed, Apr 02, 2003 at 12:45:37PM -0500, Yacketta, Ronald wrote: > I have hit a minor brain road block here, trying to regex out a line > containing all text up to the first . > > Line looks like this: > > <04/01/03 16:36:21.737 [blah]>|blah(): Throw blah from idl method: Number: > 6048 Reason:

Re: Php perl?

2003-04-02 Thread Elias Assmann
On Tue, Apr 01, 2003 at 10:42:57PM -0800, R. Joseph Newton wrote: > Neither language is strongly typed, as C, Java, or VB are. Although > both are type-sensitive, they still restrict identifiers only by > contaiment class. Could you elaborate on that? What do you mean by "type-sensitive" and "re

Re: good text editor

2002-10-23 Thread Elias Assmann
On Wed, 23 Oct 2002 [EMAIL PROTECTED] wrote: > If anyone knows of a free text editor with customizable syntax > highlighting, I'd like to know about it. Sure, try Emacs (it will probably take some getting used to though... I know it did for me). Elias -- Smileys are for the weak-minded

Re: extra space in column (obvious answer but I can't find it)

2002-10-13 Thread Elias Assmann
On Sun, 13 Oct 2002, K Pfeiffer wrote: > @words = ; > I expect @words to look like: qw# aaa\n bbb\n ccc\n # but when I print the > list I get: I bet they actually do look like that. > aaa > bbb > ccc Let me guess: you printed them like print "@words"; -- right? When you interpolate an array

Re: emacs perl mode

2002-10-12 Thread Elias Assmann
On Fri, 11 Oct 2002, David Garamond wrote: > is anybody aware of other perl > modes out there which might be 'smarter'? Yes, cperl-mode might help you. It came with my Emacs distribution. Be aware, however, that it isn't perfect either. At least in my version, it has a problem with the \( ... )

Re: what happens with $b = $b++?

2002-06-30 Thread Elias Assmann
On Sun, 30 Jun 2002, Michael Turner wrote: > > $ perl -Dt -le '$b=$b++' > > > > EXECUTING... > > > > (-e:0) enter > > (-e:0) nextstate > > (-e:1) gvsv(main::b) > > (-e:1) postinc > > (-e:1) gvsv(main::b) > > (-e:1) sassign > > (-e:1) leave > Now to go look up how you did that... especia

RE: Perl programmer born and bred

2002-06-27 Thread Elias Assmann
On Wed, 26 Jun 2002, Craig Hammer wrote: > Have you ever tried to wade through The Silmarillion? > > Craig Hammer As a matter of fact, I just bought and started reading it yesterday. I didn't yet get any further than Cristopher Tolkien's introduction :-) I do expect to like it though, as I also

Re: Perl programmer born and bred

2002-06-26 Thread Elias Assmann
On 25 Jun 2002, Randal L. Schwartz wrote: > > "Jeff" == Jeff 'Japhy' Pinyan <[EMAIL PROTECTED]> writes: > > Jeff> Perhaps this is because programmers are of the sci-fi/fantasy > Jeff> book-reading ilk, and LotR is perhaps the pinnacle of fantasy. > > As a counterpoint, I read the Hobbit two o

Re: Can you make it use one or more less vars?

2002-06-12 Thread Elias Assmann
On Wed, 12 Jun 2002, Jeff 'japhy' Pinyan wrote: > On Jun 12, Elias Assmann said: > > >On Tue, 11 Jun 2002, Jeff 'japhy' Pinyan wrote: > > > >> modifies the ACTUAL argument you passed to rcsname()? Only if you had > >> done > >> &g

Re: Can you make it use one or more less vars?

2002-06-11 Thread Elias Assmann
On Tue, 11 Jun 2002, Jeff 'japhy' Pinyan wrote: > modifies the ACTUAL argument you passed to rcsname()? Only if you had > done > > sub rcsname { > $_[0] =~ s/foo/bar/; > } > or some other specific effort would you have modified the argument to the > function. So Perl passes subroutine a

Re: shifting solved (was "Re: chomp-ing DOS lines, shifting, and avariable variable")

2002-06-09 Thread Elias Assmann
Oh my, what a bad day for my poor little brain... Sorry for all that confusion. On Sun, 9 Jun 2002, David T-G wrote: > Elias, et al -- > > ...and then Elias Assmann said... > > % be two lines, so how about this: @working = m'/mp3(/[^/]+)+';? It seems I have suffered a

Re: shifting solved (was "Re: chomp-ing DOS lines, shifting, and avariable variable")

2002-06-09 Thread Elias Assmann
On Sun, 9 Jun 2002, Elias Assmann wrote: > be two lines, so how about this: @working = m'/mp3(/[^/]+)+';? So much for posting code without trying it... This isn't working, but it isn't obvious to me why, and I don't have time right now :-( Elias -- Gefängn

Re: shifting solved (was "Re: chomp-ing DOS lines, shifting, and avariable variable")

2002-06-09 Thread Elias Assmann
On Sat, 8 Jun 2002, David T-G wrote: > % I can't modify $fullpath because I'll use it later, but for parsing I > % don't need the leading "/mp3/" part, and the only way I've found to get > % rid of it elegantly is > % > % ... > % @working = split(/\//,$fullpath) ; # cut path in

Re: complementing a scalar

2002-05-26 Thread Elias Assmann
On Sat, 25 May 2002, mark wrote: > What is happening here exactly and what precisely does the /c do in this > statement? I've had a couple of answers that I do not understand and thus > far I've been told that /c "complements" the SearchPattern. OK I'm sorry that my original reply didn't help

Re: analysis and enhancement was Re: Lies, damn lies and statistics

2002-05-25 Thread Elias Assmann
On Fri, 24 May 2002, Michael Fowler wrote: > Based on empirical evidence (that is, I looked through some saved messages > in my mailbox) and RFC822 the In-Reply-To: header consists of the Message-Id > being replied to. Given that, you could trace down to the original message > through the chain

Re: explanation of tr///cds terms?

2002-05-24 Thread Elias Assmann
Let me see if I can help here, maybe a peer-discussion (from chimpanzee to chimpanzee so to say ;-) will work better than inter-species communication with homo sapiens. On Fri, 24 May 2002, mark wrote: > " 'perldoc' is not recognised as an internal or external command, operable > program or bat

RE: uniq

2002-05-23 Thread Elias Assmann
On Thu, 23 May 2002, Jeff 'japhy' Pinyan wrote: > On May 23, Craig Hammer said: > > >Very nice explanation. One thing though, I am not using uniq to remove > >duplicates. I am using it to get a count of duplicates. In my case, I am > >creating a threshhold to determine when someone (malicious)

Re: Passing a variable to a DOS batch file

2002-04-21 Thread Elias Assmann
On Sun, 21 Apr 2002, Michael Lamertz wrote: > On Sun, Apr 21, 2002 at 01:45:27PM +0200, Elias Assmann wrote: > > > If the Perl script is the last thing the batch file executes, I don't > > really see a problem, since you could just let the Perl script emit > > th

Re: Passing a variable to a DOS batch file

2002-04-21 Thread Elias Assmann
On Sun, 21 Apr 2002, Michael Lamertz wrote: > On Sat, Apr 20, 2002 at 08:07:09PM -0400, Paul Lombardo wrote: > > I need to do the following: > > > > if the perl script fails I need to pass a variable to the batch file so it > > can exit with a proper failure message > > when the perl script succe

RE: Incrementing the letters in an array

2002-04-18 Thread Elias Assmann
On Thu, 18 Apr 2002 [EMAIL PROTECTED] wrote: > No, you need ++ vs +1. As they say in perl, ++ is magical and will do want >you want. + 1 will not. > > Wags ;) ps -- is not magical in the same sense as ++ either. How would you decrement a character then? There surely has to be a way?

Re: how to make local variable retain value

2002-04-16 Thread Elias Assmann
On 16 Apr 2002, Chas Owens wrote: > sub has_a_static_var { > #declare a "static" variable > my $static if 0; > > if (defined $static) { $static++ } > else { $static = 0 } > > #do stuff > } May I ask why you do this if-else thing here? It seems super

Re: max/min

2002-04-12 Thread Elias Assmann
On Fri, 12 Apr 2002, Jonathan E. Paton wrote: > Yes, it should be optimised away, but why would you do it in the first place? If > you tell it to do something, then why should it shy away from doing what it was > told? Optimising things that don't occur in everyday programming is a waste of > ti

Re: max/min

2002-04-12 Thread Elias Assmann
On Fri, 12 Apr 2002, Jonathan E. Paton wrote: > > I'm a litttle puzzled as to why max2 (foreach with if modifier) is > > consistently about 25% faster than max4 (foreach with ternary operator). > > My guess is that the difference is due to how often the assignment is > > done. With the if modifie

RE: max/min

2002-04-12 Thread Elias Assmann
On Thu, 11 Apr 2002, Bryan R Harris wrote: > > ACK! void use of map! > Huh? Is that "void" or "avoid"? What's wrong with map? void. You're using map in void context here (which means, if I'm not mistaken, you throw the return value away without using it), and this is said to be a Bad Thing (tho

Re: default value -simpler method?

2002-04-10 Thread Elias Assmann
> my $age = param('age') || 12; > > Is that an acceptable way of doing things, or is there some > glaringly obvious mistake? It seems to pick up null and undefined > values okay, without any errors (i.e. no age param, or age= will > get 12). Only problem is that it treats 0 as null/undefined, bu

Re: Perl 6?

2002-04-04 Thread Elias Assmann
On Thu, 4 Apr 2002, Jenda Krynicky wrote: > Ah well ... it will HURT. I'm sure I'll envy the newcomers. Since it'll > take ages to get used to the new $@% meaning and the new > operators. Just out of interest: were the changes between the last Perl versions equally drastic? (I'm thinking of 4->5 o

RE:long path and short Path

2002-03-26 Thread Elias Assmann
On Tue, 26 Mar 2002, Jorge Goncalvez wrote: > Hi, I wonder if Perl under windows know short path like dos with tildes on it. > Thanks. Well, I'm not on a Windows PC, so I can't check, but I would think it should - AFAIK, all filenames in Windows (at least on the FAT fs - might be differnet on NTF

Re: PDF

2002-01-22 Thread Elias Assmann
Firstz of all thank you all who answered. Considering the responses I got I should have included more information (I rather expected something like: "Yes, I've used Some::PDF::Module, works great and does all you need", which is why I asked like I did): The program will eventually run on a Windoze

PDF

2002-01-22 Thread Elias Assmann
Hello, I'm thinking about writing a program that would need to (among other things) produce PDFs as output. I know there are perl modules that can do that, but does anyone have any experience with them? Are they easy to learn to use (if I do it, I won't have to much time)? What's the quality of t

Re: How do I delete a file from Perl?

2002-01-12 Thread Elias Assmann
> system( rm -rf $file ); > Any tips? Try 'system("rm", "-rf", $file)'. The quotes are not really necessary here (I think), but you should use them, because otherwise "rm" and "rf" will be interpreted as barewords, and you might get in conflict with the reserved ones. HTH, Elias -- T