Re: What is this?

2001-06-06 Thread Michael Fowler
On Wed, Jun 06, 2001 at 12:02:37PM -0600, Sara Strader wrote: > Is this a Perl Script? If not, does anyone know what it is? > > File newnum: > > > 1: r+ERROR: Tried to open %s . %s. (error number %d) > 2: ./newnum.lst-d%s %d > 3: PLEASE ENTER EMPLOYEES' FULL NAME: "%s", Is this corre

Re: directory listing to array

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 11:16:36AM -0500, Evan McNabb wrote: > > I've been working on a little script for a while but I can't seem to get > this part working. What I want to do is list all of the *.jpg files in a > directory (ls *.jpg) and then have an array with each filename as elements > of th

Re: counting problem

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 07:26:12PM +0200, Raven wrote: > I want it to count like this: > --- > SLCT1000 > SLCT1001 > SLCT1002 > etc... > > but it count > - > SLCT1000 > SLCT1002 > SLCT1005 > SLCT1011 > etc.. > #!/usr/bin/perl #!/usr/bin/perl -w use strict; > $ne

Re: regexp question

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 08:25:05AM -0700, Martin Weinless wrote: > take the regexp '.n+..?.?v*.' > > By all that is sacred, if we use the string 'supernova', there should be > no match since there are too many characters before the 'n' Nope. Consider supern ova ^^ ^

Re: regex question

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 11:02:54AM -0700, Adrian Pang wrote: > I'm trying to write a regex expression so it will extract the attribute > names from a tag. For example, > > The regex should return attr1, attr2, attr3 and attr4 > Is there anyway to write these into one regex expression? Don't try

[OT] and/or operator

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 06:39:32PM -0400, Travis Smith wrote: > > Either you or I (or maybe both us) have a really dirty mind. > > > Isn't that like: > (true != 0) Nope, that's ($you || $I || ($you && $I)), which reduces to simply ($you || $I). > You know, there's no and/or operator. In k

[OT] fetchrow_hashref vs. fetchrow_arrayref

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 05:27:16PM -0400, Chas Owens wrote: > In DBI, it (fetchrow_hashref, not fetchhash) returns a hash where the > keys = column names and values = value of the columns on the row. I > consider it a generaly bad thing since it forces you to alias your > columns when you have tw

Re: INSERTing problems

2001-06-07 Thread Michael Fowler
On Thu, Jun 07, 2001 at 05:34:08PM -0400, Chas Owens wrote: > What is the airspeed of an unladen swallow? What -kind- of swallow? :) Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com --

Re: system

2001-06-10 Thread Michael Fowler
On Sat, Jun 09, 2001 at 12:45:07AM -0700, SunDog wrote: > The SYSTEM and EXEC commands will only work for scripts running on > UNIX or unix like machines if you're doing this in Windoze ... > do not expect this to work .. could just be a good time to upgrade > to a Li

Re: [META] Rants (was:Re: space)

2001-06-11 Thread Michael Fowler
On Mon, Jun 11, 2001 at 10:36:31AM +0200, Aaron Craig wrote: > >At 23:24 08.06.2001 -0500, you wrote: > > > >If you don't know how to manage your mail or aren't willing to learn then > >you probably don't have any business joining a mailing list and then > >whining about it on the list. > > > >

Re: Getting to the contents of a class..

2001-06-11 Thread Michael Fowler
On Mon, Jun 11, 2001 at 12:24:00PM +0200, Ela Jarecka wrote: > Unfortunately, it doesn't seem to work... :-( > > My constructor: > > sub new { >my $that = shift; >my $class = ref($that) || $that; >my $self = { > %myflds, >}; >bless $self, $class; >return $self; > }

Re: Passing FileHandle as Arguments Always Better?

2001-06-11 Thread Michael Fowler
On Mon, Jun 11, 2001 at 10:44:15AM -0400, Charles Lu wrote: > &function_one (\*FILE); [snip] > &function_one("temp.txt"); [snip] > Why is the first method almost always the preferred one? Neither is overwhelmingly preferred over the other, that I've seen. The only benefit to passing a reference,

Re: Getting to the contents of a class..

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 09:31:08AM +0200, Ela Jarecka wrote: > In my code, I finally wrote: > > foreach my $item ( keys %$reqrec ) { > ... > } If that's how you want to design your class to be used it's up to you, but keep in mind that it breaks encapsulation. Judging from this what you really

Re: Sorting two parallel arrays

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 05:14:19PM +0100, Martin van-Eerde wrote: > Thanks for any help! > > my @first = qw(high medium low apex); > my @second = qw(100.00 50.50 34.25 23.99); > > > my $idx = -1; > my @result = map {$idx ++; $second[$idx].'~'.$_} @first; > > print "merge result:\n"; > print jo

Re: map function has me confused

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 05:56:17PM +0100, Tom Watson wrote: > I was thinking it might be possible to do this in one line using map..? Well, there's: @new = map { my $tmp = $_; $tmp =~ s/foo/bar/; $tmp; } @original; OR (this is bad form, you shouldn't use map in void context) map {

Re: testing on email characters

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 02:19:23PM -0400, Chas Owens wrote: > /[\W.-]/ expands to /[[^a-zA-Z0-9_].-]/ Conceptually, yes, but the pattern /[[^a-zA-Z0-9_].-]/ isn't going to give you what you seem to expect if you were to actually try to use it. \w, \W, \d, \D, and friends are magic like that; the

Re: pulling 1 key from a hash

2001-06-12 Thread Michael Fowler
On Tue, Jun 12, 2001 at 08:23:43PM -, Big Bird wrote: > I have a hash of zipcode-city pairs. Since a city may have more than one > zip code, the zipcodes are the keys. If there is exactly 1 value in the > hash that matches the city in the line of the file, I need to get the key > for that

Re: checking the status of FileHandle

2001-06-12 Thread Michael Fowler
> At this point I want to close my FileHandle (OUT) if it was open. My > question is HOW do I check to see whether a filehandle(OUT) has been opened > so I can explicitly close it with The fileno operator is the typical way of determining if a filehandle is connected to something. Michael --

Re: arrays problem

2001-06-13 Thread Michael Fowler
On Wed, Jun 13, 2001 at 04:09:29PM -0400, F.H wrote: [snip] > $ssns{$ssn}{hobbies}[0][2] which should yield H3 > $ssns{$ssn}{hobbies}[3][0] to get HG. [snip] > if ($key =~ /^Hobbies/i) { > push @{$ssns{$ssn}{hobbies}}, @line[2 .. $#line]; > } >From this, your data structure i

Re: arrays problem

2001-06-13 Thread Michael Fowler
On Wed, Jun 13, 2001 at 06:00:34PM -0400, F.H wrote: > > Michael, > Thanks for taking the time to solve this problem. Of course those are not real ssn >numbers. > I tried your suggestion: > > > if ($key =~ /^Hobbies/i) { > push @{$ssns{$ssn}{hobbies}}, [@line[2 .. $#line]]; > } > }

Re: uninitialized value in numeric error

2001-06-13 Thread Michael Fowler
On Wed, Jun 13, 2001 at 04:30:01PM -0700, David Kenneally wrote: > Hello- > > This is a really basic question, sorry. Can anybody tell me why I get the > following error when I run this script: > > "Use of uninitialized value in numeric lt (<) at ./x2 line 8" "Use of uninitialized value" means

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 08:30:14AM +0200, Adrienne Kotze wrote: > $mailer = Mail::Mailer->new ("smtp", "smtp.mydomain.com") ; This should be: $mailer = Mail::Mailer->new("smtp", Server => "smtp.mydomain.com"); This is the cause of your warning. > $mailer->open ({ From => 'me <[EMAIL PROTE

Re: Help needed with setting up a SMTP connection

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 11:25:51AM +0200, Adrienne Kotze wrote: > Michael Fowler wrote: > > > > On Thu, Jun 14, 2001 at 08:30:14AM +0200, Adrienne Kotze wrote: > > > $mailer = Mail::Mailer->new ("smtp", "smtp.mydomain.com") ; > > > &g

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 01:51:29PM -0500, [EMAIL PROTECTED] wrote: > i am running through a series of if/elsif checks on a variable: > > if (($add_alias) && ($add_destination) && (!$selection)) { > >if ( $add_alias =~ /[^\w\.\-]/ ) { > >} elsif ( $add_destination !~ /\@/ ) { > >} e

Re: counting regex matches

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 05:08:30PM -0400, Carl Rogers wrote: > > > > >$string =~ /a/g; # match on all 'a' in $string > > > >Now how do I know how many times it actually matched? > > Try: > $result = $string =~ /a/g; > The value will be in $result > perl -wle '$str = "abcabcabc"; $cnt = $str

Re: nested checks

2001-06-14 Thread Michael Fowler
On Thu, Jun 14, 2001 at 11:10:43PM -0500, [EMAIL PROTECTED] wrote: > > Format to taste, of course. Your checks on $add_alias, $add_destination, > > and $selection should also probably be checks for defined'ness, not truth. > > 0 is false, but, according to your definition of what $add_alias shoul

Re: PERL DB Question

2001-06-18 Thread Michael Fowler
On Mon, Jun 18, 2001 at 01:15:44PM -0500, Prabhu, Vrunda P (UMC-Student) wrote: > I have an existing file, called mockalias that contains entries in the > following format: > > username : e-mail address > I want to use a hash %ALIAS to read the mockalias file into the hash [snip] > #!/usr/bin/per

Re: Sysopen v. Open

2001-06-18 Thread Michael Fowler
On Mon, Jun 18, 2001 at 12:52:40PM -0700, Paul Burkett wrote: > What is the difference between sysopen and open? The arguments, plain and simple. The handle created by sysopen is the same as that created by an equivalent open call, the only difference is in what arguments the functions take, and

Re: Executing commands, getting both STDOUT and STDERR from command

2001-06-19 Thread Michael Fowler
On Tue, Jun 19, 2001 at 11:09:26AM -0400, Craig Moynes/Markham/IBM wrote: > Hi, > I am running several commands within my perl script (on AIX 4.3.3). > These commands include find, chmod, etc. > What I am wondering is if anyone has a sample script kicking around where > they execute the comma

Re: variable losing it's value

2001-06-19 Thread Michael Fowler
On Tue, Jun 19, 2001 at 02:41:40PM -0700, Bob Mangold wrote: [snip] > except I can't just type 'foreach my($line) (<>)'. That's because your syntax is wrong. It should be: foreach my $line (<>) { Assuming you actually want to use foreach for such a thing. What you really should be using i

Re: variable losing it's value

2001-06-19 Thread Michael Fowler
On Tue, Jun 19, 2001 at 09:39:13PM -0400, Eric Beaudoin wrote: > At 16:39 2001.06.19, Jeff 'japhy' Pinyan wrote: > >This is because the looping variable is implicitly localized to the loop > >itself. This is not a bug. > > Has this always been the case? I was under the impression that the syntax

Re: IPC::Open3

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 09:59:38AM -0700, Paul Burkett wrote: > As a last ditch effort to get this serial device to > write I found a Perl module called "IPC::Open3" it > seems to have the ability to write to a serial device. I'm not sure where you got this idea. IPC::Open3 is for reading and wr

Re: IPC::Open3

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 11:06:19AM -0700, Paul Burkett wrote: > He do you or anybody know of a program like TIP > (creates a terminal connection to a remote host) that > will work in Perl, right now all I get is "tip:must be > interactive", thanks. What's giving you this error message? If you're

Re: IPC::Open3

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 11:26:32AM -0700, Paul Burkett wrote: > Basically I'm suppose to be able to change the cameras > which are displayed on the webpage. Right now I can > change the cameras displayed on the webpage by > accessing Tip and typing in a command like '@01' (any > value through @01-

Re: need code

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 09:11:53PM +0200, Alen Sarkinovic wrote: > Can anybody send me code of perl that will take input from web and > execute Unix command ,I mean SYSTEM(/bin/somecommand $variable) Despite someone's suggestion not to reply, I must. This is an insanely bad idea. Don't do t

Re: exec()

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 04:21:07PM -0400, Yacketta, Ronald wrote: > I have tried that, but exec fails... > exec ( 'egrep', "-c" , $lookFor , @{$LOGS[($_ -1)]} ) unless $pid=fork; # > fork new process for cmd > > is my current line.. I have tried several different ways to add the > out > and no go

Re: caller function

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 03:35:23PM -0400, Richard J. Barbalace wrote: > ($package, $filename, $line, $subroutine) = caller(); As a minor correction, this is incorrect. The argument-less form of caller returns only three elements: package, filename, and line. > So, I guess my questions a

Re: HELLO, I am new... X-)

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 04:38:14PM -0400, Chas Owens wrote: > The Perl syntax to match the VB loop above is: > > while ($a = 5 or $b = 2) { > blah blah blah; > } Chas, of course, meant ==, not =, as in: while ($a == 5 or $b == 2) { ... } VB has some weird things going on

Re: I feel like an idiot...

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 03:33:17PM -0500, Eric J. Wisti wrote: > @var is array {or list} @var is always an array. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com --

Re: substring replacement

2001-06-20 Thread Michael Fowler
On Wed, Jun 20, 2001 at 11:41:29PM +0100, Mark Bedish wrote: > I am using substrings in a screipt and wondered if there was a better > perlish way to do it. I am taking data from a mainframe system and > reformatting it but the substring seems to be quite slow, like visual > basic, the original. >

Re: Perl DB Question again

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 08:48:08AM -0500, Prabhu, Vrunda P (UMC-Student) wrote: > I have the following code: [snip] > open Fin, "mockalias"; Always check your open calls: open Fin, "mockalias" or die("Unable to open file \"mockalias\": \l$!.\n"); [snip] > My question is the followi

Re: regex headache

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 01:43:44PM -0400, Yacketta, Ronald wrote: > I have been looking for a way to search for two strings in a line > at the command line I would Well, for this you'd use something like: open(FILE, $file) || die("Unable to open file \"$file\": \l$!.\n"); while () {

Re: Limiting String Length

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 11:31:21AM -0700, Chuck Ivy wrote: > Now, looking up the substring function, it looks like if the original > string were less than the size of my substring, it would pad my variable > until it was 4096 characters. > perl -wle 'foreach my $str(qw(foo foobarblahdoo))

Re: =

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 02:01:22PM -0400, Chas Owens wrote: > On 21 Jun 2001 12:40:07 -0400, Brett W. McCoy wrote: > > > >In C++, you can overload the = operator to use the copy constructor. I don't >remember if in Perl > > you can overload = > > > > use overload "=" => \&clone; I take it,

Re: substring replacement

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 08:29:05PM +0100, Mark Bedish wrote: > I am putting tabs between the fields and then changing the a13 which is > a tso overpunch to its decimal equiv, e.g. 1234} means -123.40 . How.. odd. > As I hinted, my code is very procedural as I am not used to Perl yet. Procedur

Re: regex headache

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 02:58:02PM -0400, Yacketta, Ronald wrote: > foreach (@output) { > foreach my $test(@lookFor) { > $results{$test}++ if /$test/igo; > } > > this should create a hash etc.. etc.. > to search for multiple words above (as you suggested?) I would > > $result

Re: I discovered the problem BUT...

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 03:34:15PM -0400, Brett W. McCoy wrote: > On Thu, 21 Jun 2001, Paul Burkett wrote: > > > I found out the problem was not anything related to > > the script, rather it was the speed being inputted (is > > that a word) into the serial device. Does anyone know > > how to del

Re: I discovered the problem BUT...

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 12:45:33PM -0700, Paul Burkett wrote: > No, the default setting is 9600 I did a test with it > by making a loop on the serial devices, it seems that > the camera can only take characters at a delayed input > rate, that's why it worked in 'tip' is because I typed > it charac

Re: tutorial on my/our/use/package/local

2001-06-21 Thread Michael Fowler
On Thu, Jun 21, 2001 at 01:56:31PM -0700, Randal L. Schwartz wrote: > Ahh, I think I see the problem. The syntax for $foo actually means > the variable $main::foo (when main is the current package), and > $main::foo is a global variable, but $foo is a "local to the package" > variable. So perlmo

Re: 2 regex questions

2001-06-22 Thread Michael Fowler
On Fri, Jun 22, 2001 at 04:26:43PM +0200, Aaron Craig wrote: > $results{$test}++ if($_ =~ /joe/ && $_ !~ /fred/); Or, more succinctly: $results{$test}++ if /joe/ && !/fred/; Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com

Re: How do I determine number of matches in a regex?

2001-06-22 Thread Michael Fowler
On Fri, Jun 22, 2001 at 04:35:43PM -0400, Brett W. McCoy wrote: > > On Fri, 22 Jun 2001, Paul wrote: > > > $count = () = /$pattern/g; > > However, remember that () is not creating an array, it's creating a list > context, and then it gets forced into a scalar context. Except that's wrong, becau

Re: How do I determine number of matches in a regex?

2001-06-22 Thread Michael Fowler
On Fri, Jun 22, 2001 at 05:33:48PM -0400, Brett W. McCoy wrote: > But then it should be list(), not array(). There is list context and > scalar context, but not array context. Anyway, () is usually enough to > force a list context, if appropriate (we saw yesterday a case where it > doesn't). sc

Re: How do I determine number of matches in a regex?

2001-06-24 Thread Michael Fowler
On Sun, Jun 24, 2001 at 07:13:47PM -0300, Rogério Brito wrote: > 1 - How does the Perl grammar interprets the following statements: > > $n = () = m/string/g; > > In particular, is "()" an lvalue in Perl? Yes, it is. () is a list assignment with no values. A list assi

Re: How do I determine number of matches in a regex?

2001-06-24 Thread Michael Fowler
On Sun, Jun 24, 2001 at 11:14:25PM -0300, Rogério Brito wrote: > On Jun 24 2001, Michael Fowler wrote: > > On Sun, Jun 24, 2001 at 07:13:47PM -0300, Rogério Brito wrote: > > > $n = () = m/string/g; > > > > > > In particular, is "()" an

Re: Exceptions ( catching and handeling).

2001-06-24 Thread Michael Fowler
On Mon, Jun 25, 2001 at 09:46:06AM +0800, Rajeev Rumale wrote: > But I am not getting the proper values in $@ variable. What do you mean you're not getting the proper values in $@? What values are you getting, what are you expecting? > I would be greatfull if any one can explain the correct us

Re: Exceptions ( catching and handeling).

2001-06-24 Thread Michael Fowler
On Mon, Jun 25, 2001 at 11:29:16AM +0800, Rajeev Rumale wrote: > $done="false"; > > while( $done eq "false ") { > eval { > .. > . > read form files. > process info... > write back to files > > }; > ( $@ ) ? ($done="false") : ($done=

Re: /g

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 11:21:08AM +0100, Sally wrote: > Cheers, that's all a book had to say (and I've got loads). I'm not sure what books you have, but this is documented in the following places: 1) perlop (perldoc perlop from the command-line, or go to perldoc.com) 2) perlre (perldoc

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 01:09:51PM -0400, Chas Owens wrote: > On 25 Jun 2001 12:57:39 -0400, Yacketta, Ronald wrote: > > > select count(distinct(process)) ACTIVE from " . 'v$session' . " > > > select count(distinct(process)) ACTIVE from " . 'v\$session' . " > > What version of Perl are you using

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 02:09:59PM -0400, Chas Owens wrote: > @active = qx( > sqlplus -S $RTDUSER/$RTDPASS\@$RTD_ORACLE_SID <<-! > select count(distinct(process)) ACTIVE from v\\\$session > where last_call_et < 60 and > process in (select ltrim(rtrim(to_char(process_id) )) from > session_list); >

Re: Pooling of objects and session data

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 07:59:51PM +0200, Jos I. Boumans wrote: > poe-test.pl is the most basic one, simple starting a few threads You keep mentioning threads with relation to POE. I hope no one is under the mistaken impression that POE supports threads as in POSIX threads, or seperate threads o

Re: escaping v$session

2001-06-25 Thread Michael Fowler
On Mon, Jun 25, 2001 at 02:24:21PM -0400, Chas Owens wrote: > Let me see if I have this straight: > > Perl was ignoring $session because of the \ and then passing the output > to the shell (stripping the \). Yes. > The shell saw $session so it tried to replace it with the enviromental > varia

Re: Sort+print hashes of hashes

2001-06-25 Thread Michael Fowler
On Fri, Jun 22, 2001 at 05:25:13PM +0200, Remko Lems wrote: > for $File (reverse (sort {$All_Scores{$a}{Trimmed} cmp > $All_Scores{$b}{Trimmed}} keys %All_Scores)) { > InsertSortedEntries ($File, $All_Scores); > } [snip] > > > no > 11 > 10 > 01 > 00 > > > > That's not exact

Re: Variable scope

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 10:08:35AM -0700, Gregg Williams wrote: > When "use strict 'vars'" is in effect and you are using a global variable > (such as $emailLog), Perl will issue a warning alerting you to that > fact--for example: > > Global symbol "$emailLog" requires explicit package name at

Re: curly braces

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 04:07:06PM -0300, Silvio Luis Leite Santana wrote: > $bissexto = ; > chop($bissexto); > $bissexto and { print "OK\n" }; > print "end\n"; You obviously aren't running with warnings on. With warnings turned on, your code produces the following (perl 5.6.1): Useless use

Re: array slice question

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 04:46:24PM -0400, Bradford Ritchie wrote: > ...but I really need to print everything after the 8th element. If the > ...array were named, I could do something like this: > > @arr = split(/:/); > print @arr[1,6,8..$#arr]); Your asked question was answered well by St

Re: 'use strict' kills Oracle spooling...

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 05:17:00PM -0400, [EMAIL PROTECTED] wrote: > Does anyone familiar with 'use strict' know what may be going on? (Please > don't make fun of the way I'm accessing the database. It works, and > besides, I've been too lazy to learn about the DBI package/module thing.) I can f

Re: Finding @INC

2001-06-26 Thread Michael Fowler
On Tue, Jun 26, 2001 at 09:44:13AM -0500, Dennis Fox wrote: > My difficulty is that I don't understand how to modify @INC to > include the non-standard locations, so that I don't have to have the user > supply commandline arguments each time the script is needed. perldoc -q 'my own module'

Re: types of datas

2001-06-26 Thread Michael Fowler
On Mon, Jun 25, 2001 at 10:14:52PM +0800, Exile wrote: > Q1. simply use this : if (($a =~ $b) && ($b =~ $a)) { $match = "Y" } You're comparing $a to $b using the regex operator. I doubt you intended to do this (if you did, there are various things you did wrong); you should be comparing them wit

Re: Re: types of datas

2001-06-26 Thread Michael Fowler
On Wed, Jun 27, 2001 at 01:15:05PM +0800, Exile wrote: > >>>The problem is that when I compare the first and the second value: If > >>>they're really equals, the program say they are'nt. Notice "really equals". I will be getting back to it. > >>>Is ther a function to convert a value into an in

Re: ENV & $HOME

2001-06-26 Thread Michael Fowler
On Wed, Jun 27, 2001 at 02:37:55AM -0400, Adam Theo wrote: > i am looking for a way my perl program can automatically get the home > directory of the user. There is, of course, the HOME environmental variable. There is also (getpwuid $>)[7], which gets the home directory from the password datab

Re: Converting Unix paths to windows

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 12:08:26PM -0700, Chuck Ivy wrote: > if($0=~m#^(.*)\\#){ $cgidir = "$1"; } # win/dos > elsif ($0=~m#^(.*)/# ){ $cgidir = "$1"; } # Unix > else {`pwd` =~ /(.*)/; $cgidir = "$1"; } # Unix This is just a less portable implementation of what FindBin.p

Re: FW: rmdir

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 03:51:43PM -0500, Me wrote: > Basically, you have to write a sub that does the > following sort of thing (ignoring your wrinkle that > you don't want to delete all the files in the initial > directory): Or you could use File::Path::rmtree. I'm surprised no one has given t

Re: substr (help,help,help);

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 05:30:11PM -0400, Craig S Monroe wrote: > open (SOURCE, "< $filename"); > > while (){ > if (m/\/nic\/login/){ > substr ($_,28,4); > print; > } > } That substr is a no-op, meaning it does nothing. If warnings had been turned on, you would have seen something along the

Re: Best practice for config file use?

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 06:58:37PM +0200, Jos I. Boumans wrote: > I usually use a config file for this > now you could do this 3 ways as i see it > > -just have a file that holds a lot of global vars and 'require/use' that > in your mian script > -get one hashref that you globalise and th

Re: open +>>

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 07:17:32PM -0300, Silvio Luis Leite Santana wrote: > What would +>> do? the same as +< ? the camel-book > says nothing, as far I've read. > strace -eopen perl -wle 'open(FILE, "+>>test.txt")' 2>&1 | grep test open("test.txt", O_RDWR|O_APPEND|O_CREAT, 0666) = 3 So,

Re: using strict - ADDENDUM

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 04:53:04PM -0700, Hans Holtan wrote: > #!usr/bin/perl -w > use strict; Add: use IO::File; > > > my ($input,$output,$k,$v,$gene, $input_string, Replace this: > $output1,$output2,$output3,$output4,$output5, with this: @filehandles, > $file, $junk,$i,

Re: using strict

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 04:54:17PM -0700, Paul wrote: > Another trick -- use FileHandle and put them into an array. > > my @FILE; > for (1..5) { > $FILE[$_] = new FileHandle "CHR$_" or die "CHR$_: $!"; > } > > now you can say: > > print $FILE[$_] ">$k\t$all_genes{$k}\n"; This do

Re: Running PERL as root

2001-06-27 Thread Michael Fowler
On Wed, Jun 27, 2001 at 11:12:34PM -0400, Bill Pierson wrote: > Thanks for your replies. Actually, I'd like to be able to modify system > config files, stop and restart daemons, etc. > > I'm not aware of the different ways to accomplish this; any tips would be > appreciated. > > The server is in

Re: FW: rmdir

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 09:49:32AM -0400, Porter, Chris wrote: > Still unsure how to approach. Very new to perl and I don't want to screw > this up. Any input from you would be great. Thank you. > > -Original Message- > From: Michael Fowler [mailto:[EMAIL PROTECTE

Re: system - rsh problem

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 11:50:24AM +0200, Stefan Zwijsen wrote: > > Hi, > > I try to execute the following line on Solaris: > system ("rsh","btzp17","`/usr/local/bin/perl -e "foreach $line > (@allfiles) { print $line;}"`") ; The intent behind the code you have here is very difficult to figure o

Re: referencing a flat file DB

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 09:06:38AM -0700, Jon Riddle wrote: Be forewarned, what follows is a critique of code you didn't ask about. > #!/usr/local/bin/perl -w > > use CGI; > use CGI::Carp qw(carpout fatalsToBrowser); Always: use strict; when debugging code. > $Q = CGI; This assigns the

Re: referencing a flat file DB

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 05:34:22PM +0100, mark crowe (JIC) wrote: > > $compare = { split (/:/, $stats)}; > > @records = \$compare; > > I think you'd be better off to use: > @records = split (/:/, $stats) While this is correct.. > At the moment you are splitting t

Re: Inheritance of package global variables

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 03:05:17PM -0400, Richard J. Barbalace wrote: > The 'use base' pragma nicely takes care of the @ISA and %FIELDS > variables for me, but I also need to have the package global variable > %Attributes inherited. The 'use vars' and assignment in MyPackage is > rather verbose,

Re: background processing (again?)

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 09:51:19AM -0400, Ronald J. Yacketta wrote: > to make a long story short I have a req to-do the following. 1) gather > continues data from netstat -I hme0 $SLEEPTIME > $netstatTMPFILE & while > still parsing other information/data etc.. Given David M. Lloyd's suggestion to

Re: data matching

2001-06-28 Thread Michael Fowler
On Thu, Jun 28, 2001 at 02:34:31PM -0700, Paul wrote: > > $city = $record[3] ; > > for ($i = 0; $i <= $#{ $state{$city}; $i ++ ) { > > Never use the > for( ; ; ) { } > construct in Perl without a significant and compelling reason. > foreach is virtually always better for lots of reasons. Try

Re: Finding @INC

2001-06-28 Thread Michael Fowler
On Fri, Jun 29, 2001 at 02:24:56AM +0400, Maxim Berlin wrote: > Thursday, June 28, 2001, Randal L. Schwartz <[EMAIL PROTECTED]> wrote: > > RLS> NO NO. That doesn't work. All of those unshifts are executed REGARDLESS > RLS> of the $OS type. > [...] > Randal, thank you for your patience and examp

Re: data matching

2001-06-29 Thread Michael Fowler
On Thu, Jun 28, 2001 at 08:50:12PM -0400, F.H wrote: I'm not sure if the lack of indentation is in your original code or not, but in case it is, for the sanity of people that need to read your code (like us!) please indent, and indent consistently. Also, always use warnings and strict when debug

Re: data matching

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 10:15:54AM -0400, F.H wrote: > CITY:while (my $line = ){ > > my @line = split /\s*,\s*/, $line; > my $city = $line[3]; > > foreach my $city (keys %state) { > foreach my $street (@{ $state{$city} } ){ > if (

Re: short filehandle question

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 02:28:50PM +0200, Ela Jarecka wrote: > Hi, > Executing my program with -w option I get the following warning: > 'Value of construct can be "0"; test with defined() at readData > line 65535.' > > Surely I do not have 65535 lines in my program, but I suspect this one: > >

Re: module install

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 11:31:28AM -0500, Hal Wigoda wrote: > When you install a perl module from CPAN > should you do it as root??? Often the answer you'll see in response to this question is "yes", as evidenced by the two answers I see to your question already. The real answer is "it depends"

Re: Inheritance of package global variables

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 12:14:23AM -0400, Richard J. Barbalace wrote: > I don't really want to export the variables; I'm not modifying them in > the parent package, just copying and expanding them in the inheriting > package. Well then, you are copying and modifying as simply as it can be done.

Re: loop counting

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 02:58:20PM -0400, Jeff 'japhy' Pinyan wrote: > No there is not. Either do: > > my $i = 0; > for (@foo) { > # ... > } > continue { $i++ } > > or do: > > for my $i (0 .. $#foo) { > my $element = $foo[$i]; > # ... > } or for (my $i = 0; $i < @

Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 06:04:33PM -0400, Wang, Lanbo wrote: > #!/usr/local/bin/perl This is your first mistake. You forgot -w and use strict; always use both when debugging code. It wouldn't have helped you here, but I guarantee you it will in the future. So: #!/usr/local/bin/perl -w us

Re: Problem with hash value

2001-06-29 Thread Michael Fowler
On Sat, Jun 30, 2001 at 12:28:11AM +0200, M.W. Koskamp wrote: > From: Wang, Lanbo <[EMAIL PROTECTED]> > > Hi Members, > > #!/usr/local/bin/perl > > > > sub card{ > > > > my %card_map; > > my ($num)=@_; > > @card_map{1..9}= qw(one two three four five six seven eight nine); > > You are putting

Re: [OT:style]deleting a line with a particular string.

2001-06-29 Thread Michael Fowler
On Fri, Jun 29, 2001 at 10:21:31AM +1000, Sam Lander wrote: > I wanted to do this just today. Although, I want to tidy up the resulting > line a bit by deleting everything before a colon, so I tried this: >perl -ne "/string/ && print s/.*://" file > I was surprised that I got this: >1

Re: restarting sendmail through system( );

2001-07-01 Thread Michael Fowler
On Sun, Jul 01, 2001 at 01:54:23PM -0500, [EMAIL PROTECTED] wrote: > the script builds a new /etc/aliases that is composed all all the customer > pieces. this happens properly, however, when i attempt to restart sendmail > and run newaliases from within the same script, the newaliases output > sho

Re: Printf

2001-07-02 Thread Michael Fowler
On Mon, Jul 02, 2001 at 09:58:43AM +0100, Govinderjit Dhinsa wrote: > $fields[0],$fields[5],$fields[70],$fields[71],$fields[72],$fields[75],$field > s[76],$fields[77],$fields[78],$fields[79]; If I couldn't get away with this atrocious by-position form (a hash, with sanely named and thus self-docu

Re: using the backspace \b character

2001-07-02 Thread Michael Fowler
On Mon, Jul 02, 2001 at 06:17:17AM -0700, Bob Mangold wrote: > I know I can use the backspace character to overwrite previous characters > and the such, but can I use it to backup a few lines. Lets say I write: > > print "hello\n"; > print "world"; > > I know that: > > print "\b"; > print "a";

Re: encrypt password

2001-07-02 Thread Michael Fowler
On Mon, Jul 02, 2001 at 06:42:36PM +0400, Maxim Berlin wrote: > Monday, July 02, 2001, F.H <[EMAIL PROTECTED]> wrote: > > FH> I want to be able to encrypt the password line only, but be able to > FH> read from it. > > crypt. > > perldoc -f crypt Keep in mind that crypt is a one way hash; you c

Re: backticks

2001-07-02 Thread Michael Fowler
On Mon, Jul 02, 2001 at 04:06:47PM -0300, Silvio Luis Leite Santana wrote: > It seems the backtick operator calls the shell, otherwise > it wouldn't be able to redirect output to file saida. Backticks aren't the only thing that uses the shell, nor do they always use the shell. A simple `pwd` won

  1   2   3   4   5   6   7   >