Re: comparing floating point numbers

2005-07-25 Thread James Sluka
<>Robert's solution (rounding with sprintf) is pretty good, except it requires that you know something about the numbers. For example, they must differ by more than 0.01 to be considered different. What happens when the two numbers are;   0.101   0.100 Now you need to check fo

Re: Regex

2005-09-20 Thread James Sluka
Perhaps you need to change the final \D to \D* since it is possible that there is nothing after the 7 digits. Or perhaps omit the last \D completely. Your code works with; $body='Library Card: 0240742 '; # has a character after the 7 digits but fails with; $body='Library Card: 0240742';

Re: Back-slashes & calling a batch file from perl ???

2005-10-28 Thread James Sluka
One more thing to try is to add a trailing space after the directory spec, as in;     system qq{$prog "$dir " $dest} or     my $cmd = qq{$prog "$dir "  "$dest"}; I did some quick tests with; ##Perl code my $prog = 'c:\windows\desktop\some-batch.bat'; my $dir  = 'c:\windows\desktop\jim'

Re: Back-slashes & calling a batch file from perl ???

2005-10-28 Thread James Sluka
I agree bill, it does not make sense, nonetheless on my win98 machine (creak creak), the extra space is required. jim $Bill Luebkert wrote: James Sluka wrote: One more thing to try is to add a trailing space after the directory spec, as in; system qq{$prog "$dir "

Re: rand() not so random

2005-12-01 Thread James Sluka
[EMAIL PROTECTED] wrote: I know it "shouldn't" make a difference, but we all know that things that shouldn't, do. I wasn't seeding it explicitly, was letting perl handle it. Unless it's a bug, my theory is that mod_perl is keeping the old seed from the last compile. Mod_perl does not recompile

Re: rand() not so random

2005-12-01 Thread James Sluka
At 05:53 AM 12/1/2005 -0800, [EMAIL PROTECTED] wrote: random <> unique. If you want unique numbers also put your routine above in your program and discard duplicates. True but over some interval they should be unique. If they're going to repeat every 10 or 20 times u hit the submit

Re: split() skipping trailing delimiters

2005-12-05 Thread James Sluka
DZ-Jay wrote: Hello: I have a problem using the split() function: When there are trailing delimiters, without any content between them, split() skips them. For example, this: my @foo = split(/,/, 'this,is,a,test,,'); yields: this is a test while I'm expecting:

Re: Sort question

2005-12-16 Thread James Sluka
I have an array of values. How can I sort these values that has a non numeric character [ _ ] in it? What I did was parse the numbers before the "_" character and then perform a number short on those value, but there must be an easier way? Any help is greatly appreciated. 55_20051202

Re: Yet another regex question

2006-01-12 Thread James Sluka
<>Ted wrote: <>while () { chomp; if ($_ =~/\d\s[A-Z]{3}\s/) { $_ = s/$1/$1\t/g; } print FILETO "$_\n"; } You were close Ted but there are a couple problems. 1. $_ = s/$1/$1\t/g; should be $_ =~ s/$1/$1\t/g; (you left out the ~) 2. $1 isn't defined anywhere in this code sinc

Re: Multi Dimensional Arrays

2006-02-01 Thread James Sluka
I am a newbee in perl. Just wanted some guidance so as to how to implement multidimensional arrays in perl. I have to create an 2-d array with 26*26 of all the english alphabets so that for each row and column i can have a partiulcar value like a to a =1 b to a=2; I am just not getting how to impl

Re: RE help

2006-05-04 Thread James Sluka
1. There is a missing semicolon on the first line. 2. Does "$string" really contain line breaks? If it does you need the "s" option in the regex. how about this; v use strict; my $string = 'John Smith, Susan Miers President'; # missing semicolon # ass