RE: Check numbers

2004-06-18 Thread Thomas, Mark - BLS CTR
Joe wrote: my $Num = 010233405560; my @list = split/(..)/, $Num; my $last = pop @list; foreach (@list) { print $_ is too big, must be 33 or less\n if $_ 33; } print $last is too big, must be 52 or less\n if $last 52; Another way: my @num = $Num =~ /(\d{2})/g; my @max =

RE: Check numbers

2004-06-18 Thread Jim Guion
Here is how I got it to work, the print statements are just so I could see what was happening: #!/Perl -w use strict my $Num = 010233405560; my @list = $Num =~ /\d\d/g; my $i; for ($i = 0; $i 5; $i++) { #print \$list[$i]: '$list[$i]'\n; #NOTE: It's a 'string' here! $list[$i] =~ s/^0//:

RE: Check numbers

2004-06-18 Thread Joseph Discenza
Jim Guion wrote, on Friday, June 18, 2004 11:57 AM : NOTE: On my system, Windows2000 desktop running Cygwin, the original : 'split' line had a 'blank' at the beginning of the array it returned! Right! I didn't mention that. The blanks test as 0, and will always be less than 33; I used pop to

RE: Check numbers

2004-06-18 Thread Thomas, Mark - BLS CTR
Jim Guion wrote: #print \$list[$i]: '$list[$i]'\n; #NOTE: It's a 'string' here! $list[$i] =~ s/^0//: #Strips the leading zeroes! #print \$list[$i] now: '$list[$i]'\n; #NOTE: Number now, good! Wrong and completely unnecessary. Leading zeros have nothing to do with whether it's a 'string'

RE: Check numbers

2004-06-18 Thread Jim Guion
That is what I thought, too. At some point, during my attempt to get it all to work correctly, I was seeing it return true for 01 32, and I can't reproduce it now. Well, whatever, I am now able to comment out the substitution line and it works fine as you pointed out, Mark Jim Guion Sr.

csv file read write

2004-06-18 Thread Viswanatha Rao
I have two questions: 1. I open a CSV file and parse it. If it does not exist I create it. Immediately after the program I try to open the csv file with MS-Excel, it gives error in reading. 2. How do I write and or append to the file in CSN format, an array of values in a single column?

search and replace problem and line break-up

2004-06-18 Thread Miha Radej
hi! i'm writing a script which does some file copying and similar and have stumbled upon two problems i thought will be easy but i didn't manage to solve them on my own. firstly, i have a file consisting of lines which contain certainf filter instructions. like so: last f:\centrale\n300\d*.asm

Chop!

2004-06-18 Thread Suchindra Sandhu
Greetings, Suppose I have a string like $sequence = [sas]; How can I get rid of the leading and trailing brackets and just have $sequence = sas; One way I thought of was : chop($sequence); reverse($sequence); chop($sequence); reverse($sequence); This doesnt seem very clever. Can someone

Re: Check numbers

2004-06-18 Thread Sisyphus
[EMAIL PROTECTED] wrote: I'm having a problem with my snippet below. The numbers need to be under a certain size. There are 6 numbers in the variable $Num 01 02 33 40 55 and 60. I need to check if the first 5 numbers are below 33 and the last number is 52 or less. The below snippet will return all

RE: Chop!

2004-06-18 Thread Wagner, David --- Senior Programmer Analyst --- WGO
[EMAIL PROTECTED] wrote: Greetings, Suppose I have a string like $sequence = [sas]; How can I get rid of the leading and trailing brackets and just have $sequence = sas; $sequence =~ s/\[([^]]+)\]/$1/g; This will remove it. Wags ;) One way I thought of was : chop($sequence);

RE: Chop!

2004-06-18 Thread Arms, Mike
Suchindra Sandhu [EMAIL PROTECTED] wrote: Suppose I have a string like $sequence = [sas]; How can I get rid of the leading and trailing brackets and just have $sequence = sas; One way I thought of was : chop($sequence); reverse($sequence); chop($sequence); reverse($sequence); This

Re: AS perl 810 source anf MinGW

2004-06-18 Thread Jeff Griffiths
Hey, We ran two builds with success. Here is what we did: 1. Downloaded the 810 source zip file from downloads.activestate.com 2. Extracted the source 3. Made sure that include was pointed to vc6.0/include and lib was pointed to vc6.0/lib 4. Switched to the 810 extracted source and typed: nmake

Re: AS perl 810 source anf MinGW

2004-06-18 Thread Sisyphus
Jeff Griffiths wrote: What are you doing differently? The big difference (I think) is that I'm using the MinGW (gcc) compiler. I do also have VC 7 (Visual Studio .NET), and there's no problem for me building perl with that compiler (and nmake), but for most of my projects, a MinGW-built perl

Re: search and replace problem and line break-up

2004-06-18 Thread $Bill Luebkert
Miha Radej wrote: hi! i'm writing a script which does some file copying and similar and have stumbled upon two problems i thought will be easy but i didn't manage to solve them on my own. firstly, i have a file consisting of lines which contain certainf filter instructions. like so:

Re: Chop!

2004-06-18 Thread $Bill Luebkert
Arms, Mike wrote: Suchindra Sandhu [EMAIL PROTECTED] wrote: Suppose I have a string like $sequence = [sas]; How can I get rid of the leading and trailing brackets and just have $sequence = sas; One way I thought of was : chop($sequence); reverse($sequence); chop($sequence);

regexp!

2004-06-18 Thread Ananthan S
hi., what is regular expression ? And in hash variable can get a key through its value..? Please clear me.. and point out me some good website on perl programs and faqs Thanks // Ananthans //

Re: regexp!

2004-06-18 Thread $Bill Luebkert
Ananthan S wrote: hi., what is regular expression ? And in hash variable can get a key through its value..? You can't get a key from a value as easily as you can get a value from a key, but if your values are unique, you could do it be reversing the hash. If you have

need some help on parsing csv file

2004-06-18 Thread Viswanatha Rao
I need some help! 1. I open a CSV file and parse it. If it does not exist I create it. Immediately after the program runs, when I try to open the csv file with MS-Excel, it gives error in reading. I am working on a windows box. Here is the code: my $csv = Text::CSV_XS-new({