Re: How to use command-line switches...

2003-06-26 Thread Brett W. McCoy
[EMAIL PROTECTED] wrote: I have a case where I need to use a command-line switch such as -X or /x Could anyone help me with information as to how I read this into a perl script and test it - along the lines of if /x then... ?? perldoc Getopt::Std and perldoc Getopt::Long -- Brett -- To

Re: using whence

2003-06-26 Thread Brett W. McCoy
David Parker wrote: Hi. I have a perl script that calls various programs. I would like to be able to verify that a given program is being called from the right place - what I would use whence for in the korn shell. I tried $path = `whence $cmdname`; but I don't get anything in $path. I'm

Re: Problem with ^ oprator

2003-04-04 Thread Brett W. McCoy
On 4 Apr 2003, Rado Petrik wrote: I have two number $a=6; #binary - 0110 $b=10; # 1010 I need work this operation a OR b 0110 - 6 OR 1010 - 10 - 1110 - 14 this is true; buy when I use this operator ^ in perl $a^$b then output is 12 0110 - 6 OR

Re: NewBie Question! Please Help

2003-03-27 Thread Brett W. McCoy
On Thu, 27 Mar 2003, Palm Optins wrote: I writting a script so when members join my program it writes their Email Address into a flat file. I have it adding to the file this way. open (FILE, $cgiroot/memdata/address/members.txt); flock(FILE, 2); print FILE $list\n; flock(FILE, 8); close

Re: perl DBI

2003-03-25 Thread Brett W. McCoy
On 26 Mar 2003, mark sony wrote: What are the good online sites which will give details about perl DBI, about using perl interacting with databases,right from basic to advanced stage? Start with http://dbi.perl.org/ -- Brett

Re: Urgent: How do I find real file instead of link

2003-03-19 Thread Brett W. McCoy
On Wed, 19 Mar 2003, Ohad Ohad wrote: I have a link and want the real file that it is pointing to. This means also if I have a linked list of links I want to get the real file at the end. That's a bit tricky, but it can be done. You'll need to use the stat builtin to get at the file

Re: Good Perl cgi book?

2003-03-18 Thread Brett W. McCoy
On Tue, 18 Mar 2003, Dennis Stout wrote: That is the mother of all perl books. It's also more of a reference book than anything else. Altho if you're that type of learner, it'll be a great read. It should also sit on the bookshelf of any Perl programmer, regardless of whether they use it to

Re: Problem with regular expressions!!!

2003-03-18 Thread Brett W. McCoy
On Tue, 18 Mar 2003, Marcelo Taube wrote: As u probably have guessed some part of my code is not working properly and i don't understand why!! This is the code. # $file_completename =~ /(.*?)\.(.*)/; if ($2 eq $extension]) { #DO SOMETHING!!! }

Re: Evaluating parts of a string

2003-03-18 Thread Brett W. McCoy
On Tue, 18 Mar 2003, Navid M. wrote: I was wondering how you can evaluate parts of a string: Ex: $fileName = File; $var = '1$fileName'; Now I would like a *simple* way of evaluating $var such that only '$fileName' gets substituted for its value. 'eval' doesn't work since it tries to

Re: Evaluating parts of a string

2003-03-18 Thread Brett W. McCoy
On Tue, 18 Mar 2003, Navid M. wrote: No, I can't use double quotes. This is what's being done: . One of my perl scripts is sending this string 1$filename' to another perl script, and it's in the second perl script where $filename is defined. So I need to take the string '1$filename'

Re: Evaluating parts of a string

2003-03-18 Thread Brett W. McCoy
On Tue, 18 Mar 2003, Navid M. wrote: But this won't work if $var='1$fileName'. I was hoping there would be a simple way getting around this without using any regexps. I think Pete's solution is as simple as it gets! -- Brett

Re: Problems with while loop and array

2003-03-17 Thread Brett W. McCoy
Erwin Zavala wrote: I know I could use the filehandle but I am trying to understand why I cannot use the array and print each element at the time. #!/usr/bin/perl use strict; use Fcntl; $/ = \n\n; sysopen(readFile, cnnArticle.txt, O_RDONLY) || die $!; sysopen(writeFile, fortuneCookie.txt,

Re: filehandle problem

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003 [EMAIL PROTECTED] wrote: How can I see what file handles are pointed at a given file. I am having a problem where I open, read, and close a certain file. Then another part of the script tries to open that same file, but can't. I suspect something is holding it open.

Re: Free cgi-bin?

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Liebert, Sander wrote: Does anyone know of a free cgi-bin. I am having some problems with a script and wanted to narrow it down to rule out email. I don't need a free website, just a place that can run and execute my script. I have searched on google, but I'm only

Re: help with whois code

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Thomas Browner wrote: Could some one help me with this code. Every time that I this code: use Net::Whois; use Carp; $dom =digidyne.com; my $w = new Net::Whois::Domain $dom or die Can't connect to Whois server\n; ^^^ Need a closing here -- Brett

RE: help with whois code

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Tony Esposito wrote: BTW - Anyone know where to get the Carp module for Perl 5.6.1 on Win32 ( WindowsNT ) and how to install it? I am using the OpenPerl IDE and it complains about not being able to locate Carp. I checked and it is not on my Win32 system. Did you try

RE: help with whois code

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Tony Esposito wrote: Addendum: I tried CPAN and my search(es) do not show the module itself. Thanks! It's right there under the Core Modules listing: http://www.cpan.org/modules/by-category/02_Perl_Core_Modules -- Brett

Re: internal server error

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Robbie Staufer wrote: I have a partial perl script for a mock-up web page, that will collect information from users as part of a registration form. In trying to see what it looks like so far on the web, I'm getting an internal server error. I thought that the script,

RE: help with whois code

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Tony Esposito wrote: I am using SiePerl. I had trouble installing ActiveState on WindowsNT for some reason ( probably OE but I did not want to mess with it ) even though it installed fine on Windows2000. The OpenPerl IDE fails to even open up with the WindowsNT version

RE: help with whois code

2003-03-17 Thread Brett W. McCoy
On Mon, 17 Mar 2003, Tony Esposito wrote: I checked my whole system for Carp.pm and it was nowhere to be found. Perl seems to work fine from the command line. It is the OpenPerl IDE that seems to need it ( for stack tracing I am guessing ). In fact, the OpenPerl IDE in debug mode stops

Re: help with whois code

2003-03-17 Thread Brett W. McCoy
David Olbersen wrote: Quoting issues, I think you meant: perl -MCarp -e croak('croaked') Yeah... forgot it's Win32 command-line... :-) -- Brett http://www.chapelperilous.net/

Re: Capture wget progress bar

2003-03-15 Thread Brett W. McCoy
Robert Rendler wrote: Currently I'm unable to capture wget's progress bar (the one with the arrow). It doesn't appear to be using STDOUT or STDERR. So this his not working: open WGET, wget foo.moo 21 | or die Couldn't run wget: $!\n; while(WGET){ It's likely that wget is writing directly to the

Re: perl cron (Slightly off subject)

2003-03-15 Thread Brett W. McCoy
Gregg R. Allen wrote: I finally got my perl script that checks our POP3 server working (thanks everyone), but I want to run it every 5 minutes eventually, but every minute during testing. How do I set the crontab entry for periodic minutes? I am running Yellow Dog Slackintosh (Linux PPC).

Re: sprintf questions

2003-03-13 Thread Brett W. McCoy
On Wed, 12 Mar 2003, David Gilden wrote: Is the following considered ok as in good PERL style? #!/usr/bin/perl -w $num =1.12345; my $tax_formated = sprintf(%.2f, $num); # --- THIS LINE print $tax_formated ,length($tax_formated), \n; The important thing is, does it do what youo are

RE: html table limit

2003-03-12 Thread Brett W. McCoy
On 12 Mar 2003, Rob Benton wrote: Is there a limit to how many rows you can put in an html table? I can't find anything wrong with my script but when I get over 1000 rows or so in my tables they start drawing weird borders. I think if you are needing tables on an HTML page that have

RE: html table limit

2003-03-12 Thread Brett W. McCoy
On 12 Mar 2003, Rob Benton wrote: 1000+ rows is a rare situation on my page but in can happen. It's a dbi script. I couldn't really think of a better design but I am open to suggestions... Ideally you could page the returned data in groups of 100. Take a look at this:

RE: Regular Expressions http error code

2003-03-12 Thread Brett W. McCoy
On Wed, 12 Mar 2003, Romeyn, Derek wrote: K, I tried this and it didn't work as expected: $code =~ / HTTP\/\d\.\d\ (\d+)/; if (!$code) { print NEXT\n; next; } print $code\n; The loop just printed NEXT 300 or so times. I

RE: Regular Expressions http error code

2003-03-12 Thread Brett W. McCoy
On Wed, 12 Mar 2003, Brett W. McCoy wrote: You're not capturing the correct string. Here's a code snippet I just tried on an Apache log that worked (assuming you have an open file handle): while(LOG) { print $1\n if m|HTTP.*\s+(\d{3})|g'; } $1 contains the matched string inside

Re: dynamic variable declaration?

2002-05-01 Thread Brett W. McCoy
On 1 May 2002, rory oconnor wrote: If I were to hard-code these declarations, I would have about 40 lines that look like: $order_id = $session-get_query_value('order_id'); $customer_id = $session-get_query_value('customer_id'); $bill_prefix = $session-get_query_value('bill_prefix');

Re: Print Question

2002-04-05 Thread Brett W. McCoy
On Fri, 5 Apr 2002, Balint, Jess wrote: Hello all. I have been working on this all day. I am trying to print out numbers 1 through 10 as this loop progesses. For some reason, it doesn't print the numbers until the end of the loop. The $done variable is set to 1 by the getUniqRand() function

Re: Camel Book

2002-03-20 Thread Brett W. McCoy
On Wed, 20 Mar 2002, Octavian Rasnita wrote: I heard about that famous Camel Book for Perl but I don't know its real name. The full name is _Programming Perl_, by Larry Wall, et al. It's an O'Reilly book and can be found in any bookstore that has a computer section. -- Brett

Re: Can someone explain the difference ?

2002-03-19 Thread Brett W. McCoy
On Tue, 19 Mar 2002, Kamali Muthukrishnan wrote: I have the following perl-script , which gives the user ( supposedly a first or second grader) a problem in addition or subtraction by generating random numbers. The random numbers generated are between 1 and 10 for first graders and 10 and

Re: first glimpse of regex

2002-03-19 Thread Brett W. McCoy
On Tue, 19 Mar 2002, Matthew Harrison wrote: i need to say something like if $username = then ... where is literally nothing. i want to match it ONLY if the variable is totally empty. this is my first experience with regex so what should this be? if(!$username) { } An empty

Re: extracting params to a hash

2002-03-05 Thread Brett W. McCoy
On Tue, 5 Mar 2002, Jeff 'japhy' Pinyan wrote: On Mar 4, Shaun Fryer said: I'm trying to convert an old script that used cgi-lib.pl over to using CGI.pm. In order to save time I'd like to simply do something like what follows (though that doesn't actually work it seems). %in = param;

Re: Asynchronous Perl

2002-03-04 Thread Brett W. McCoy
On Mon, 4 Mar 2002, Jason Frisvold wrote: I'm looking for a way to have perl output in an asynchronous manner. What I mean is, if I write a perl script to generate a large amount of data and output it to the screen, it seems to pause until some unknown buffer is full and then spit out

Re: Can I do this with perl?

2002-03-04 Thread Brett W. McCoy
On Mon, 4 Mar 2002, Dave Adams wrote: I have a problem which I would like to use perl to resolve, however I'm not sure if it is possible to do. I need to scan a file and check some conditions, first if field 9 is duplicated on 1 or more rows, then I need to check field 10 to see which is

Re: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Jon Molin wrote: It merely depends on your preferences, readable/maintanable code vs quick dirty. if there's no difference, what's the point of having both? I can't see how readable/maintanable would increase by adding functions with the same name, it'd rather

RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Nikola Janceski wrote: what the heck is TIMTOWDI? It's TMTOWTDI There's More Than One Way To Do It 00 pronounced like tim-toady. -- Brett http://www.chapelperilous.net/

Re: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Dennis G. Wicks wrote: It is really sad when people can't get their MLA (Multi-Letter Acronym) correct! It should be TIMTOWTDI There Is More Than One Way To Do It I prefer http://www.chapelperilous.net/

Re: TIMTOWDI Was: RE: some questions about for, foreach

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Brett W. McCoy wrote: On Fri, 1 Mar 2002, Dennis G. Wicks wrote: It is really sad when people can't get their MLA (Multi-Letter Acronym) correct! It should be TIMTOWTDI There Is More Than One Way To Do It I prefer Err, ignore that... I hit C-x instead

Re: Time and date formats

2002-03-01 Thread Brett W. McCoy
On Fri, 1 Mar 2002, Troy May wrote: What do the letters after the %02 mean? I know about %02d, but I came across a few scripts with %02u in it. I've never seen that, what does it mean? What's the difference between the d and the u? And what ELSE can you possibly use there? I can only

Re: making phone calls using a perl module

2002-02-28 Thread Brett W. McCoy
On Thu, 28 Feb 2002, Johnathan Kupferer wrote: I would also be interested if anyone knows how to do this. We have several system monitors that would be much more efficient if they could actually call us when there is a problem rather than just sending email. We have a pager that can

Re: making phone calls using a perl module

2002-02-28 Thread Brett W. McCoy
A followup: I found some modules on CPAN regarding Perl Telephony: Module Telephone::Number (G/GI/GIULIENK/WWW-SMS-0.06.tar.gz) Module Telephony::CTPort (V/VO/VOICET/ctserver-0.3.tar.gz) Module Telephony::Phonedev (Contact Author David Huggins-Daines [EMAIL

Re: What's up with STDOUT in a function call?

2002-02-28 Thread Brett W. McCoy
On Thu, 28 Feb 2002, Steven M. Klass wrote: Heres a simple one PrintSummary (STDOUT, /%runset); sub PrintSummary { $prtout = shift; print $prtout This is a test } Why doesn't this work? STDOUT is a filehandle, and has to be handled differently. The safest way is to pass

Re: Does Perl have Case Statements?

2002-02-28 Thread Brett W. McCoy
On Thu, 28 Feb 2002, Chris wrote: I have been looking in the Learning Perl book, and cannot find it. There isn't a syntactical element in Perl to do case statements (aka switch in C/C++ Java). However, they can be done in a variety of ways: use the Switch.pm module or use the aliasing for

Re: Does Perl have Case Statements?

2002-02-28 Thread Brett W. McCoy
On Thu, 28 Feb 2002, Chris wrote: I have been looking in the Learning Perl book, and cannot find it. There isn't a syntactical element in Perl to do case statements (aka switch in C/C++ Java). However, they can be done in a variety of ways: I forgot to add that there is also a FAQ entry

Re: =head1 ?? -Huh

2002-02-27 Thread Brett W. McCoy
On Wed, 27 Feb 2002, Steven M. Klass wrote: Can you guys clue me in to what this means? How do I use it, and why would I use it? perldoc perlpod -- Brett http://www.chapelperilous.net/

Re: cygwin/activestate/linux

2002-02-27 Thread Brett W. McCoy
On Wed, 27 Feb 2002, Tyler Cruickshank wrote: Ive been using perl for a year or so on various platforms (Sun/UNIX, linux, NT-cygwin, Active State). Do people recommend ActiveState over cygwin for the NT system - how about ActiveState on Linux? Not being a system guru Id like to use the

Re: reading a file line by line

2002-02-27 Thread Brett W. McCoy
On Wed, 27 Feb 2002, Jon Serra wrote: Greetings, I am trying to read a text file into a scalar variable line by line until EOF or a search test if fullfilled. I have been reading files in like this: chomp (@line = `cat filename`); I do not want to do this beacuse my file is quite large,

Re: making phone calls using a perl module

2002-02-27 Thread Brett W. McCoy
On Wed, 27 Feb 2002, Joe Echavarria wrote: I am looking for a perl module that can be used to make phone calls using a voice modem so when the phone is picked up the user can hear a recorded message (mp3 file). Any idea where i can find that module. Oh, boy, phone spam. -- Brett

Re: Anyone still use cgi-lib.pl?

2002-02-22 Thread Brett W. McCoy
On Fri, 22 Feb 2002, Kevin Old wrote: I was wondering if anyone still used cgi-lib.pl anymore or used any of its subroutines for processing data in their applications. I am writing a secure application and don't see any harm in using the ReadParse subroutine for processing the data, but

Re: sharing subroutines

2002-02-22 Thread Brett W. McCoy
On Fri, 22 Feb 2002, bob ackerman wrote: is there a way to share uncompiled perl scripts? that is, to include the subroutines of one script file into another script file. failing that, can i easily compile a perl script and use it in a script? why am i having trouble figuring this out? Take

Re: SHIFT in a subroutine

2002-02-20 Thread Brett W. McCoy
On Wed, 20 Feb 2002, Nestor Florez wrote: I was wondering about the shift inside a subroutine. I have never used it. What is the purpose of it been there? It pulls off the first element of the array passed to it. Using shift with no arguments always pulls from @_ -- it returns $_[0] and

Re: SHIFT in a subroutine

2002-02-20 Thread Brett W. McCoy
On Wed, 20 Feb 2002, Curtis Poe wrote: Great description with one minor caveat: shift with no arguments will pull from @ARGV if not used in a subroutine. Yes, thanks for pointing that out. -- Brett http://www.chapelperilous.net/

RE: Unix commands in Perl scripts

2002-02-20 Thread Brett W. McCoy
On Wed, 20 Feb 2002, Booher Timothy B 1stLt AFRL/MNAC wrote: You simply enclose your unix commands in ''. i.e. #!untested 'ls -la' I think you mean ` `, (backticks), right? -- Brett http://www.chapelperilous.net/

Re: Object Question

2002-02-20 Thread Brett W. McCoy
On Wed, 20 Feb 2002, phinney wrote: I have an object method that allocates quite a bit of memory through fillung up an array. I then pass that array back to the calling program. Now, if I destroy the array that I passed back (though an undef), the memory still seems to be allocated by the

Re: system

2002-02-19 Thread Brett W. McCoy
On Tue, 19 Feb 2002, Tony McGuinness wrote: I have the following code and the system call just does not happen. Furthermore there is no error message. $arg = $Basedir/ftpscr; system($arg) == 0 or die cannot execute ftpscr $!; At this stage $Basedir/ftpscr exists and is an executable ksh

Re: Is it just a question of preference/time/money?

2002-02-19 Thread Brett W. McCoy
On Tue, 19 Feb 2002, Nikola Janceski wrote: I have old perl code, but it still does what it needs to, and is currently being used. Now I need to make changes to the code, (about once every 4 months). Over time we all code better -- learning better ways to write things, clearer ways to write

Re: Grep function inside a for loop does grep the values.

2002-02-19 Thread Brett W. McCoy
On Tue, 19 Feb 2002 [EMAIL PROTECTED] wrote: Can somebody help me on what is wrong in the following piece of code? foreach (@prv_lst) { $item = $_; @list_prv = grep (/$item/, @txn_log); print The foll. are the Txn details for Trading Partner $item \n;

Re: Matching a variable against nothing

2002-02-19 Thread Brett W. McCoy
On Wed, 20 Feb 2002, Daniel Falkenberg wrote: Just wondering how I check if a variable contains nothing or not. I thought it was something like the following... if ( $string eq '' ) { print String contains nothing; } else { print The string contains the following: $string; } Yes,

Re: Spaces in form values -- cgi

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, David Gilden wrote: option value=kayak touring rescue techniquesKayak Touring Rescue Techniques/option Or do I need to use underscores, option value=kayak_touring_rescue_techniquesKayak Touring Rescue Techniques/option I believe the spaces will get replaced with %20.

RE: printing \n automagically?

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, Dennis G. Wicks wrote: Thanks! That works great! But!!!: [root@iodine root]# man perlvars No manual entry for perlvars [root@iodine root]# perldoc perlvars No documentation found for perlvars. [root@iodine root]# Should be perldoc

Re: convert ctime to a string

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, Dermot Paikkos wrote: Does anyone know how to either get the ctime as a string or convert the interger into a date that is meaning full?? Sure: my @stats = stat($file); print Create Time: , scalar(localtime($stats[10])), \n; See perldoc -f localtime -- Brett

Re: convert ctime to a string

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, Brett W. McCoy wrote: Does anyone know how to either get the ctime as a string or convert the interger into a date that is meaning full?? Sure: my @stats = stat($file); print Create Time: , scalar(localtime($stats[10])), \n; I'm sorry, that's not the create

Re: Error from a `cmd` sent to a subroutine?

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, Paul Farley wrote: I have an application that I am using a perl script to do pattern matching and then execute commands specific to that application. I need a way to handle an error in my script if one of the `cmd blah`; doesn't work and send it to an error subroutine.

Re: SPLIT

2002-02-15 Thread Brett W. McCoy
On Fri, 15 Feb 2002, Agustin Rivera wrote: How would I keep the character (or characters) that I am splitting by? for example, @tags=split(//, $line); I would like to keep the . In other words, you have the string 'blahbluhblug', you want to split it, and end up with (blah, bluh, blug) ?

Re: buton names

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, GsuLinuX wrote: It worked on normal submit buttons but problem on image submit button. I couldn't manage to work it with image submit buttons. Fot example if their 2 image submit buttons as : input type=image border=0 name=button3 value=This is button 3

Re: Urgent - Getting the left most 3 characters from a string...

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Chris wrote: if left($result,3) = 500 Then Do whatever Else Blah Blah Blah End If In Perl I want to do: if (left($result), 3) = 500 { Do whatever; } else { Blah Blah Blah; } How can I do the left in Perl if(substr($result, 0, 3) == 500)

Re: String manipulation help needed

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Brian Johnson wrote: I need a string in the form Wed, 18 Jul 2001 14:20 Of course my line doesn't quite cut it. my $emaildate = join , $record-{day}, $record-{month}, $record-{year}, $record-{hour}, $record-{minute}; Just interpolate the variables directly

Re: is it a bug? (less-equal compare)

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Dittrich G. Michael wrote: I do: $lowerlimit = 89 le 100; response I do: $lowerlimit = 89 le 99; response 1 please help me! I dont get it! is this a bug? or am I nuts? You are comparing strings here when you really want to be comparing numbers. In terms of

Re: Regular Expressions - matching the first time

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Russ Foster wrote: I have string, something like: $String = aaa bbb: fffd: sdfsdf qweqd: adfsdf qwcdsfs: qwdq qchuti: qwiojd; Now, I want to extract everything from the start of the string, up through the FIRST colon : -- in this case aaa bbb. My regex looks

Re: Help me out

2002-02-14 Thread Brett W. McCoy
On Thu, 14 Feb 2002, Matthew Peter Lyon wrote: hey, leading off this... a question for the group... are the ways in programming to solve problems / situations called 'design patterns' ? Well, sorta... 'design patterns' refers to a specific way of analyisng software design. It actually comes

Re: regular expressions

2002-02-14 Thread Brett W. McCoy
On Fri, 15 Feb 2002, terri harrison wrote: If my input is in the form: Name: Happy, Species: Cat, Gender: Male Name: Peanut, Species: Hamster, Gender: Female how come foreach (keys %names) { if ($names{$_} =~ /\s*Gender:\s*$gen\s*/i) { AND if ($names{$_} =~ /\s*Species:\s*$sp\s*/i) {

RE: array question

2002-02-13 Thread Brett W. McCoy
On Tue, 12 Feb 2002, Pankaj Warade wrote: This is work my @array = ( 1, 2, 3, 4 ); print $#array; --- size of array. No, $#array is the index of the last element of the array. To get the size of an array, just put the array into a scalar context: my $size = @array; print scalar(@array);

Re: Scan data for XML invalid characters and parse articles

2002-02-13 Thread Brett W. McCoy
On Wed, 13 Feb 2002, John wrote: I have a scalar variable containing HTML that needs to be converted to XML. It's not the best HTML so it has invalid characters (like smart quotes, 1/2 character, etc.). I need to determine if these characters exist in the data and throw an error if they

Re: Number Truncation/Rounding

2002-02-13 Thread Brett W. McCoy
On Wed, 13 Feb 2002, Balint, Jess wrote: Hello all. I have a script that uses alot of data and calculates a cumulative percent of this data. That cumulative percent should be 100.00 at the end. What I get is: 99.8 I need to truncate this to 2 decimal places and hopefully round

Re: use, require, do... which is appropriate?

2002-02-12 Thread Brett W. McCoy
On Tue, 12 Feb 2002, W P wrote: my problem is simple. i have a number of scripts on my server, and i would like all of them to initially run a function defined by me. however, it would be burdensome to write that function over for every script. creating a custom module, however, doesn't

Re: Arrays 1x3 or 3x1 - The real questions

2002-02-12 Thread Brett W. McCoy
On Tue, 12 Feb 2002, Steven M. Klass wrote: Let's start off with some simple code.. my $arg = SomeFunction ( my @arry = qw/one two three/) sub SomeFunction { my @array = @_[0]; No, you are only grabbing the first element of @_. You should either pass the array as a reference

Re: Array question

2002-02-12 Thread Brett W. McCoy
On Tue, 12 Feb 2002, Kevin Butters wrote: I have an array that I want to insert elements into. I want to insert elements at specific points in the array. Example: use strict: @week = (Monday, Wednesday, Friday); I want to expand the array to include Tuesday after element 0 and

Re: Array question

2002-02-12 Thread Brett W. McCoy
On Tue, 12 Feb 2002, Michael Fowler wrote: Consider: @week = qw(Monday Wednesday Friday); print @week\n; splice(@week, 1, 0, Tuesday); print @week\n; splice(@week, 3, 0, Thursday); print @week\n; Duh, didn't even consider using a 0 offset in my example. --

Re: Reading a big text file

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Octavian Rasnita wrote: To store the file in an array, then to insert the changed value in that array, and then to write that array to the file, or to use a temporary file to store each line from the source file and twhen I want to modify a line, I have just to insert it

RE: beginners-cgi Digest 8 Feb 2002 17:29:24 -0000 Issue 165

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Allen Wang wrote: I want to change the string d:\orant\oracle to d:\\orant\\oracle Anyone know how to do this? $string =~ s|\\||g; (\ is used to escape metacharacters in a regexp, so you need to escape \ also). -- Brett

Re: image button submit?

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Josiah Altschuler wrote: Is there a way to use an image button in CGI.pm to submit? Sure: print image_button(-name='name', -src='path/to/img'); will produce: input type=image name=name src=/path/to/img / This is documented in the CGI.pm documentation, accessible via

Re: procmail or perl to drop dups?

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Dennis G. Wicks wrote: Has anyone developed any method to drop messages that are cross-posted to both [EMAIL PROTECTED] and [EMAIL PROTECTED]? Here's the procmail recipe I use for duplicates: :0 Whc: msgid.lock | formail -D 8192 msgid.cache :0 a: DUPLICATES -- Brett

Re: How do I get trim or rounding on a float number ?

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, FLAHERTY, JIM-CONT wrote: $ aver = $total_hours/$total_jobs some times comes up with 24.97 . I would like to round or trim to 24.99 for example . any Ideas ?? my $aver = sprintf(%.2f, $total_hours/$total_jobs); perldoc -f sprintf -- Brett

Re: Wierd Error

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Balint, Jess wrote: Hello all. I am getting wierd errors on the following piece of code. 95:for( 0..$#vars ) { 96:if( defined( $vars[$_] ) ) { 97:$freqidx{$key}[$_] += $fields[$vars[$_]]; 98:} 99:

RE: Copy for Access Tables?

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Ned Cunningham wrote: I guess this means nobody knows anyway to do this??? With Perl, you can manipulate Access tables using DBI and the DBD::ODBC driver. But if Access is not loaded on the system, you could have trouble if you don't have the correct ODBC driver for

RE: Wierd Error

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Balint, Jess wrote: That errors seems to be quieted. THank you. Now, there is this 114: foreach( sort( keys( %freqidx ) ) ) { 115: print( $_| ); 116: print( $_| ) foreach( @{$freqidx{$_}} ); 117: print( \n ); 118: } I get the error:

RE: Wierd Error

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Balint, Jess wrote: Nope. Not possible. There are array refs stored in each $freqidx{$_}. It is spitting out that error messages tons of times. Then what about the array elements in @{$freqidx{$_}} -- could uninitialized values be there? -- Brett

RE: Wierd Error

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Balint, Jess wrote: Only if counts as uninitialized. I would mind making be zero in that case. Nope, counts as a value, one that returns boolean false, but still a value that will return true if you test for definedness. -- Brett

Re: dbi modules

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Eric Jones wrote: Hello, I have perused the archives but can't find an answer to my problem. I have built a perl program, I use DBI.pm in it. Upon running the program I get the following return: Can't locate loadable object for module DBI in @INC (@INC contains:

Re: dbi modules

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Eric Jones wrote: Yes that is what I am getting. IF the object exists but is unloadable and I have run cpan to load mods what is the best move? uninstall and install cpan or is this possible? or just run CPAN again and make changes to the info? I'd try reinstalling first

Re: dbi modules

2002-02-08 Thread Brett W. McCoy
On Fri, 8 Feb 2002, Eric Jones wrote: Done and so far that works except it won't connect to the DB now through socket 111. But at least I know it's no longer perl mods acting up and I know what to look for and how to fix it next time. thanks for the advice Out of curiosity, what database

Re: To write a script that reads numbers from STDIN and print onSTDOUT.

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, Bruce Ambraal wrote: Could any one write some coding for the problem. In perl against Linx could someone help. I want to write a script that reads in four numbers from STDIN and add the first two together, and than adds the second 2 together. The input format is a

Re: module errors

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, GsuLinuX wrote: we wroted a perl code to fetch some information we want from a web site. The code is as below: #!/usr/bin/perl use LWP::Simple; use HTML::Parse; snippage We have the debug error: Can't locate HTML/Parse.pm in @INC(@INC contains:

Re: module errors

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, Uwe Voelker wrote: use HTML::Parse; The module is called HTML::Parser. A further investigation via CPAN showed me that HTML::Parse is part of the HTML::Tree bundle and is now actually a deprecated module, according to the readme. -- Brett

Re: Never had this happen before!

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002 [EMAIL PROTECTED] wrote: My program won't compile when the sub routine is in the program, but when I remove it from the program and put it into another file that I call test.pl, and compile test.pl which contains only the sub routine I'm checking, it compiles fine! Why

Re: multiple quotes

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, Mike Smith wrote: How do I get this to work? (too many quotes) print pimg border=0 src=BD08906_.gif width=190 height=156\n; print qq(pimg border=0 src=BD08906_.gif width=190 height=156\n); qq() is the generic form of . You can also use qq{}, qq##, etc. See the perlop

Re: What is the URL for the perlop page?

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, Mike Smith wrote: What is the URL for the perlop page? At the command line (Unix or Windows) type 'perldoc perlop'. It's bundled with your Perl installation. -- Brett http://www.chapelperilous.net/

Re: is Shell.pm deprecated?

2002-02-07 Thread Brett W. McCoy
On Thu, 7 Feb 2002, Jenda Krynicky wrote: I guess there are two reasons. 1) Noone knows about it. 2) With the current version it's not possible to specify a path to the program to run. But IMHO if enhanced a bit, this could be the easies way to run an external command. Jenda -- I

  1   2   3   4   5   6   7   >