Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Tyler Gee
have to change it :). i have just given you a hint. > > > > Ashok > > > > On 8/31/06, Owen <[EMAIL PROTECTED]> wrote: > > > > > > On Wed, 30 Aug 2006 15:44:53 -0700 (PDT) > > > "Mary Anderson" <[EMAIL PROTECTED]> wrote: > >

Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Jay Savage
On 9/1/06, Lou Hernsen <[EMAIL PROTECTED]> wrote: Well... he's right Right is a matter of opinion. Trolling is a matter of fact. And he's a troll. At this point, it doesn't really matter if he's right or wrong. Its confusing and overly complicated, in its multiple syntaxes, for a compiled lan

Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Tyler Gee
a cgi > > application. I have a loop which reads certain fields, hashed on names. > > Some of my fields hold character strings, some hold numbers. Sometimes > > the number field is a blank. I need a test on the field value > $fieldValue > > which will tell me if my fie

Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Lou Hernsen
e the time right now to learn a new language. Rev. Lou Hernsen self employed - Original Message - From: "Paul Archer" <[EMAIL PROTECTED]> To: "Derek Ash" <[EMAIL PROTECTED]> Cc: Sent: Friday, September 01, 2006 10:07 AM Subject: Re: figuring out if a numbe

Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Paul Archer
Derek, it was nice of you to include your title and all. That way when a future (potential) employer Googles you, they'll know for sure that it was you that was this childish and immature. 8:13am, Derek Ash wrote: Perl Sucks! Derek Ash Application Programmer II University of Illinois Colleg

Re: figuring out if a number/character string is null in Perl

2006-09-01 Thread Derek Ash
; > > Hi All, > >I know this isn't strictly a cgi problem, but it is arising in a cgi > > application. I have a loop which reads certain fields, hashed on names. > > Some of my fields hold character strings, some hold numbers. Sometimes > > the number field is

Re: figuring out if a number/character string is null in Perl

2006-08-31 Thread Ashok Varma
ECTED]> wrote: > > Hi All, >I know this isn't strictly a cgi problem, but it is arising in a cgi > application. I have a loop which reads certain fields, hashed on names. > Some of my fields hold character strings, some hold numbers. Sometimes > the number field is a

Re: figuring out if a number/character string is null in Perl

2006-08-30 Thread Owen
fields hold character strings, some hold numbers. Sometimes > the number field is a blank. I need a test on the field value $fieldValue > which will tell me if my field was blank regardless of whether it holds a > character string or a number. > > I would like to say som

Re: figuring out if a number/character string is null in Perl

2006-08-30 Thread Wiggins d'Anconia
Mary Anderson wrote: > Hi All, >I know this isn't strictly a cgi problem, but it is arising in a cgi > application. I have a loop which reads certain fields, hashed on names. > Some of my fields hold character strings, some hold numbers. Sometimes > the number field i

figuring out if a number/character string is null in Perl

2006-08-30 Thread Mary Anderson
Hi All, I know this isn't strictly a cgi problem, but it is arising in a cgi application. I have a loop which reads certain fields, hashed on names. Some of my fields hold character strings, some hold numbers. Sometimes the number field is a blank. I need a test on the field

Odd number of elements in hash assignment at AssignEvaluators.pl line 172.

2004-04-29 Thread Richard Heintze
The following statement is causing the warning in the subject line. Am I doing something wrong or is there a flaw in the cgi module I'm using? line 172: foreach ($q->param) { I am also getting this same error (or is it a warning?) when I call a function: $Case = $factory->mfr(name => $Data{"Ca

Re: checking if its a real number

2003-03-04 Thread Janek Schleicher
On Wed, 26 Feb 2003 19:47:35 -0500, Casey West wrote: > Here's a nice trick. Use the int() function. It's documented in > perlfunc, a short to the documentation is 'perldoc -f int'. > > When passed a string, int() will return 0. When passed a number, it >

Re: checking if its a real number

2003-03-04 Thread Janek Schleicher
On Wed, 26 Feb 2003 16:30:56 -0800, T. Murlidharan Nair wrote: > Is there a quick and easy way to check this. I was trying using a reg exp > if(/^[-0-9][\.0-9]*/) { > do something > } In CPAN there's also a module Regexp::Common that has a lot of commonly requested regexps. E.g. also $RE{num}{re

Re: checking if its a real number

2003-03-03 Thread Todd Wade
t; : >> Is there a quick and easy way to check this. I was trying using a reg exp > : >> if(/^[-0-9][\.0-9]*/) { > : >> do something > : >> } > : >> > : >> but this breaks when the number is say --75.4 It still accepts if it > : >> has tw

Re: checking if its a real number

2003-02-27 Thread T. Murlidharan Nair
. I was trying using a reg exp if(/^[-0-9][\.0-9]*/) { do something } but this breaks when the number is say --75.4 It still accepts if it has two - signs. $_ = 4.01; if (/\D/){ print "has nondigits\n" } if (/^\d+$/) { print "is a whole number\

Re: checking if its a real number

2003-02-27 Thread Felix Geerinckx
on Thu, 27 Feb 2003 13:34:40 GMT, [EMAIL PROTECTED] (Zentara) wrote: > if (/\D/){ print "has nondigits\n" } > if (/^\d+$/) { print "is a whole number\n" } > if (/^-?\d+$/) { print "is an integer\n" } > if (/^[+-]?\d+$/){

Re: checking if its a real number

2003-02-27 Thread zentara
thing >} > >but this breaks when the number is say --75.4 It still accepts if it >has two - signs. $_ = 4.01; if (/\D/){ print "has nondigits\n" } if (/^\d+$/) { print "is a whole number\n" } if (/^-?\d+$/) { print "is an integer\n

Re: checking if its a real number

2003-02-27 Thread Gary Stainburn
quick and easy way to check this. I was trying using a reg exp > : if(/^[-0-9][\.0-9]*/) { > : do something > : } > : > : but this breaks when the number is say --75.4 It still accepts if it > : has two - signs. > > Here's a nice trick. Use the int() function. It'

Re: checking if its a real number

2003-02-27 Thread Casey West
-9][\.0-9]*/) { : >> do something : >> } : >> : >> but this breaks when the number is say --75.4 It still accepts if it : >> has two - signs. : : I just created a script for testing on the CLI for requiring 5 digit zip : code, for which i have imported 50,000 zip cod

Re: checking if its a real number

2003-02-27 Thread Casey West
: } : : but this breaks when the number is say --75.4 It still accepts if it : has two - signs. Here's a nice trick. Use the int() function. It's documented in perlfunc, a short to the documentation is 'perldoc -f int'. When passed a string, int() will return 0. When pass

Re: checking if its a real number

2003-02-27 Thread Felix Geerinckx
on Thu, 27 Feb 2003 00:30:56 GMT, [EMAIL PROTECTED] (T. Murlidharan Nair) wrote: > I have a cgi that need to accept only numeric values. ie +ve or > -ve real numbers. > Is there a quick and easy way to check this. This is a FAQ. See perldoc -q float -- feliex -- To unsubscribe, e

RE: checking if its a real number

2003-02-26 Thread Robert Wideman
>> I have a cgi that need to accept only numeric values. ie +ve or -ve >> real numbers. >> Is there a quick and easy way to check this. I was trying using a reg exp >> if(/^[-0-9][\.0-9]*/) { >> do something >> } >> >> but this breaks when the num

checking if its a real number

2003-02-26 Thread T. Murlidharan Nair
I have a cgi that need to accept only numeric values. ie +ve or -ve real numbers. Is there a quick and easy way to check this. I was trying using a reg exp if(/^[-0-9][\.0-9]*/) { do something } but this breaks when the number is say --75.4 It still accepts if it has two - signs. Thanks for

Re: Number format control

2003-01-29 Thread the sequel
Use the same syntax and only change the command: sprintf insted of printf. //fluff - Original Message - From: "Jattie van der Linde" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 29, 2003 3:02 PM Subject: Number format control c syntax equi

RE: Number format control

2003-01-29 Thread wiggins
rl command outputting a floating point number without >decimals. I read telephone from the database and they print as 6704046.0 I want to >get rid of the .0 > Should work the same, perldoc -f printf , perldoc -f sprintf. Assuming you don't care, you could always turn it into

Re: Number format control

2003-01-29 Thread Janek Schleicher
On Wed, 29 Jan 2003 14:02:47 +, Jattie Van Der Linde wrote: > c syntax equivalent: printf ("%3.0f",Value); /*if value = 123.456 result would be >123*/ > > What is the equivalent perl command ... printf "%3.0f", $Value; Cheerio, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Number format control

2003-01-29 Thread Jattie van der Linde
c syntax equivalent: printf ("%3.0f",Value); /*if value = 123.456 result would be 123*/ What is the equivalent perl command outputting a floating point number without decimals. I read telephone from the database and they print as 6704046.0 I want to get rid of the .0 -- To unsu

Column number

2003-01-28 Thread N. Ganesh Babu
Hi, To represent line number in error file we will use $. To represent column number in error file what is the prompt? Help will be appreciated. Regards, Ganesh -- N. Ganesh Babu Asst. Production Manager Apex Logical Dataconversion Pvt. Ltd. 303 & 304 M.G.R. Estate Dwarakapuri Co

Re: Mystery number 1 in output

2002-10-10 Thread Ovid
--- Ramon Hildreth <[EMAIL PROTECTED]> wrote: > Hi, > When the sub (listed below) is called, it generates a "1" within > tags as the first table cell in the table. > I am mystified to as why this is happening. I just have td's with labels > and form elements. > ?? > Any ideas, is this a bug? Yo

Mystery number 1 in output

2002-10-10 Thread Ramon Hildreth
-value => "", -maxlength=>'40', -size=>'40', )]), td([ "phone number: ",

RE: Rounding a number

2002-09-13 Thread Bob Showalter
> -Original Message- > From: Mike Craig [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 10:02 PM > To: [EMAIL PROTECTED] > Subject: RE: Rounding a number > > > Hi, > > Unless I have missed exactly what you need, this should work >

RE: Rounding a number

2002-09-12 Thread Mike Craig
D] Subject: RE: Rounding a number > -Original Message- > From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 4:54 AM > To: [EMAIL PROTECTED] > Subject: Rounding a number > > > Hi all, > > I would like to round a number but

RE: Rounding a number

2002-09-12 Thread Kipp, James
woops that won't work :-( does perl have a ceil function? > -Original Message- > From: Kipp, James [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 11:58 AM > To: 'Octavian Rasnita'; [EMAIL PROTECTED] > Subject: RE: Rounding a number > &g

Re: Rounding a number

2002-09-12 Thread William McKee
Yet another example of how to do rounding; this time using sprintf (I think I grabbed this from a TechRepublic Perl Tip email) ROUNDING NUMBERS USING SPRINTF Perl doesn't have a function specifically for rounding numbers to a specified number of decimal places. However, yo

RE: Rounding a number

2002-09-12 Thread Kipp, James
do you mean ro round up to the next num, if so: $num = 1.2; $roundup = int($num) +1; > -Original Message- > From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 4:54 AM > To: [EMAIL PROTECTED] > Subject: Rounding a number > > &

RE: Rounding a number

2002-09-12 Thread Bob Showalter
> -Original Message- > From: Octavian Rasnita [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 4:54 AM > To: [EMAIL PROTECTED] > Subject: Rounding a number > > > Hi all, > > I would like to round a number but to the next integer not

Re: Rounding a number

2002-09-12 Thread Robin Cragg
How about: my $nu = 1.543 $num =~ s/\..*$//; $num++; it's not exactly pretty, but it does work... R At 11:53 12/09/2002 +0300, Octavian Rasnita wrote: >Hi all, > >I would like to round a number but to the next integer not like the int >function does. > >I've tri

Re: Rounding a number

2002-09-12 Thread Christopher G Tantalo
Octavian Rasnita wrote: > Hi all, > > I would like to round a number but to the next integer not like the int > function does. > > I've tried: > > my $num = 1.33; > $num = $num + 0.49; > $num = sprintf "%.0f", $num; > > This works but I am

Rounding a number

2002-09-12 Thread Octavian Rasnita
Hi all, I would like to round a number but to the next integer not like the int function does. I've tried: my $num = 1.33; $num = $num + 0.49; $num = sprintf "%.0f", $num; This works but I am wondering if there is a cleaner and better solution because there is a small cha

RE: number

2002-06-20 Thread Scot Robnett
lse {} (or elsif). The ^ character means "starts with" in a regex. Scot R. inSite -Original Message- From: Bo Mangor [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 1:49 PM To: [EMAIL PROTECTED] Subject: SV: number Hi again Great thanks to all the quickly answers! I tr

Re: SV: number

2002-06-20 Thread fliptop
Bo Mangor wrote: > > But how does it work? "if(string =~/^[0-9]/)" > > The part string =~/^[0-9]/ - does it split the string into single > numbers and check if each of them is a part of the list [0-9] ?? > I want to be scour that I have understood the Principe correct. i would suggest

SV: number

2002-06-20 Thread Bo Mangor
0-9] ?? I want to be scour that I have understood the Principe correct. Best regards Bo -Oprindelig meddelelse- Fra: Christopher G Tantalo [mailto:[EMAIL PROTECTED]] Sendt: 20. juni 2002 20:25 Til: Bo Mangor Emne: Re: number Bo Mangor wrote: > Hi there > > I'm a new bir

RE: number

2002-06-20 Thread Scot Robnett
ursday, June 20, 2002 1:17 PM To: [EMAIL PROTECTED] Subject: number Hi there I'm a new bird to Perl - and I have a little problem. I have a file input where I split the file into an array and that works fine, but there is some "spam" in the beginning of the file I want to get rid

Re: number

2002-06-20 Thread Felix Geerinckx
s > with this "spam"! > > Therefore I want to make a check that excludes all lines there doesn't > start with a number > [...] > How do I make this check In Perl? #! perl -w use strict; while () { last if /^\d+/; } do { print; # or do s

RE: number

2002-06-20 Thread Scot Robnett
my $file = '/path/to/file'; if ($file !~ /^\d/) { . } -Original Message- From: Bo Mangor [mailto:[EMAIL PROTECTED]] Sent: Thursday, June 20, 2002 1:17 PM To: [EMAIL PROTECTED] Subject: number Hi there I'm a new bird to Perl - and I have a little problem. I have a f

number

2002-06-20 Thread Bo Mangor
with this "spam"! Therefore I want to make a check that excludes all lines there doesn't start with a number in other languages I would make a check like If (! isNaN(string)) { } How do I make this check In Perl? I haven't been able to find something similar in Perl, bu

Re: At least a number of characters - regular expressions

2002-06-10 Thread Janek Schleicher
Octavian Rasnita wrote at Sun, 09 Jun 2002 08:42:34 +0200: > Hi all, > > I want to check if in a string there are more than 3 capital letters. I've tried >using: > > if ($string=~ /[A-Z]{3,}/) { > > } > } > This match at least 3 capitals only if they are one after another. I want to check

Re: At least a number of characters - regular expressions

2002-06-09 Thread David T-G
Teddy -- ...and then Octavian Rasnita said... % % Hi all, Hello! % % I want to check if in a string there are more than 3 capital letters. % I've tried using: % % if ($string=~ /[A-Z]{3,}/) { ... % % For example, I want to match this string: "AxxxBxxxCxxx". That's not so bad: [zero] [9

At least a number of characters - regular expressions

2002-06-09 Thread Octavian Rasnita
Hi all, I want to check if in a string there are more than 3 capital letters. I've tried using: if ($string=~ /[A-Z]{3,}/) { } This match at least 3 capitals only if they are one after another. I want to check if the string contains at least 3 capitals, doesn't matter how are they position

Re: pattern matching for serial number

2002-04-26 Thread Joshua Hayden
165AGKB and it would still pass the reg exp because the proper formatted serial number is embedded somewhere in that string. With the ^ and $, it will only pass if these are the only characters in a string. Best Regards, JOSHUA D. HAYDEN - Original Message - From: "Tim Doty"

RE: pattern matching for serial number

2002-04-26 Thread Tim Doty
L PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: pattern matching for serial number > > > Sorry, while typing I missed the slash, it is there in my code as - > if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /) > Is there any thing wrong with this ? > Kamali > >>

Re: pattern matching for serial number

2002-04-26 Thread Kamali Muthukrishnan
Sorry, while typing I missed the slash, it is there in my code as - if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} /) Is there any thing wrong with this ? Kamali >>> fliptop <[EMAIL PROTECTED]> 04/26/02 08:54AM >>> Kamali Muthukrishnan wrote: > Hi guys : > I have serial numbers with a pattern : 3 nu

RE: pattern matching for serial number

2002-04-26 Thread Bob Showalter
> -Original Message- > From: Kamali Muthukrishnan [mailto:[EMAIL PROTECTED]] > Sent: Friday, April 26, 2002 9:39 AM > To: [EMAIL PROTECTED] > Subject: pattern matching for serial number > > > Hi guys : > I have serial numbers with a pattern : 3 numbers follo

Re: pattern matching for serial number

2002-04-26 Thread fliptop
Kamali Muthukrishnan wrote: > Hi guys : > I have serial numbers with a pattern : 3 numbers followed by 2 capital letters >followed by 3 numbers. > To validate this - > if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} ) > { # display error ; } > I get a syntax error. i think you're missing a

pattern matching for serial number

2002-04-26 Thread Kamali Muthukrishnan
Hi guys : I have serial numbers with a pattern : 3 numbers followed by 2 capital letters followed by 3 numbers. To validate this - if ($serial !~ m/[0-9]{3}[A-Z]{2}[0-9]{3} ) { # display error ; } I get a syntax error. Can you help me , please ? Kamali -- To unsubscribe, e-mail: [EMAI

Re: Counting the number of form fields returned with information

2002-04-18 Thread Teresa Raymond
#no checkboxes# my %params = $q->Vars; foreach my $i (keys %params) {if ($params{$i} eq "" || $params{$i} eq " ") {print <<"PrintTag"; Error! Alert! I'm sorry but all fields need to be filled out except the check boxes. Please push the back button on your browser and try again. PrintT

Re: Counting the number of form fields returned with information

2002-04-18 Thread fliptop
[EMAIL PROTECTED] wrote: > On Wed, 17 Apr 2002 [EMAIL PROTECTED] wrote: > > sub missing_params { > foreach (keys %form_fields) { > next if defined param($_); > push @missing,$form_fields{$_}; > } > return scalar(@missing); > } what if a value is the null string? you need to ch

Re: Counting the number of form fields returned with information

2002-04-18 Thread eric-sourceforge
On Wed, 17 Apr 2002 [EMAIL PROTECTED] wrote: > What's the simplest way to make sure that all 10 fields have been > selected? I was hoping that... A slightly shorter, more elegant solution: #! /usr/bin/perl -w use CGI qw(:standard); use vars qw(%form_fields @missing); %form_fields = (

Re: Counting the number of form fields returned with information

2002-04-18 Thread eric-sourceforge
On Wed, 17 Apr 2002 [EMAIL PROTECTED] wrote: > What's the simplest way to make sure that all 10 fields have been > selected? This seems pretty straight-forward: param() returns a list of all form elements - even the form elements without values. To check that each field contains a value. #! /

Counting the number of form fields returned with information

2002-04-17 Thread eric-sourceforge
Hello, All: What's the simplest way to make sure that all 10 fields have been selected? I was hoping that... display_error_message() if param() < 10; would work, but it doesn't seem to work correctly. -- Eric P. Los Gatos, CA -- To unsubscribe, e-mail: [EMAIL PROTECTED] For addition

problem using Number::Format module

2002-03-09 Thread GsuLinuX
Hi from Ýstanbul,   I don't know if my problem is related with Number::Format module. The problem is like below:   I want to convert a number to comma seperetad with Number::Format module ( 42345765 --> 42,345,765 )   I got 2 cgi files that one of them is wokin' but

Regexp using look behind to del " when not preceded by number

2002-03-03 Thread José I. Donnell
Hello: Been following the discussions for some time. The help has been invaluable, but I have a regexp that I am having trouble with. I am working on a search engine for my sites FAQs. The user can enter any text they choose. The subroutine replaces all char that are not A-Za-z0-9 " \s with

RE: Determine number or word

2001-10-11 Thread Moon, John
page 75 of the Camel book .. $cnt = tr/0-9//; count the digits in $_ hope this gets you started ... -Original Message- From: Rene Verharen [mailto:[EMAIL PROTECTED]] Sent: October 11, 2001 15:59 To: Beginners-CGI List Subject: Determine number or word Hi, Is there a simple way to

Determine number or word

2001-10-11 Thread Rene Verharen
Hi, Is there a simple way to determine if a variable contains a number or (one or more) alpha-nummeric characters ? Vriendelijke groet, Rene Verharen [EMAIL PROTECTED] http://www.verharen.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: Random Number Generation

2001-08-05 Thread Michael Kelly
On 8/5/01 10:12 AM, Brian wrote: > Okay guys, can we PLEASE not post messages to both the beginners and the > beginners-cgi lists? I'm on both, and I know that lots of the people > out there are on both. So, we end up with 2 copies of each message. > Plus, if you have your filters set up stupid

RE: Random Number Generation

2001-08-05 Thread Brian
Okay guys, can we PLEASE not post messages to both the beginners and the beginners-cgi lists? I'm on both, and I know that lots of the people out there are on both. So, we end up with 2 copies of each message. Plus, if you have your filters set up stupid like some of us (yeah, me) you end up wit