[7655] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1281 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 6 17:17:28 1997

Date: Thu, 6 Nov 97 14:00:24 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 6 Nov 1997     Volume: 8 Number: 1281

Today's topics:
     Re: 'sort'ing umlauts <jhi@alpha.hut.fi>
     Re: An excellent example of perl madness (or "split stu <markm@nortel.ca>
     Re: An excellent example of perl madness (or "split stu <westmj@esvax.dnet.dupont.com>
     Command line options kchadha@hotmail.com
     Re: Command line options (Stephen O. Lidie)
     Re: Exact string matches <markm@nortel.ca>
     Extended REs in Perl 5.00401: /x extension failure or b <willie.anderson@analog.com>
     Re: extracting values from localtime <barnett@houston.Geco-Prakla.slb.com>
     Re: extracting values from localtime <markm@nortel.ca>
     Re: Fork workaround for Win32 (Neil Briscoe)
     Help with ugly regex schadsey@coralsys.com
     HELP! newbie ques: browser says HTTP 501 not supported <Dean_Lyons@hp.com>
     Re: How to send mail w/in Perl program? (Faust Gertz)
     Re: Making script wait <buxx@buxx.com>
     Passing Variables <dale@horizonint.com>
     Re: Perl Build Failure (Neil Briscoe)
     Re: Perl, Sendmail, CGI (David Siebert)
     Re: PERL->ADO->SQL <NoSPAMa-jackg@microsoft.com>
     Recursive Search and Replace question (Drake Cleary)
     Regular Expressions <gnew@southernvirginia.edu>
     Re: Regular Expressions (Mike Stok)
     Re: simple problem <barnett@houston.Geco-Prakla.slb.com>
     Re: simple problem <markm@nortel.ca>
     Re: simple problem <henry@DotRose.com>
     SSLeay from Perl <jason@syrres.com>
     Re: Taking notice of "Use of uninitialisaed value" warn (Brian Mitchell)
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 06 Nov 1997 22:47:29 +0200
From: Jarkko Hietaniemi <jhi@alpha.hut.fi>
Subject: Re: 'sort'ing umlauts
Message-Id: <oeezpnh3g2m.fsf@alpha.hut.fi>


otto@gauss.math.brown.edu (Ottavio G. Rizzo) writes:

> 
> toutatis@_SPAMTRAP_toutatis.net (Toutatis) writes:
> > Randy Jay Yarger <randy@hs1.hst.msu.edu> wrote:
> > > I'm trying to figure out a way to sort a list of names which contain some
> > > characters with umlauts. The character with the umlaut should appear after
> > > the corresponding character without. So with the list:
> > > 
> man I18N::Collate
> 
> (If you're not using Unix: oh well... then it's your problem :)

Please don't.  Do NOT use I18::Collate any more.

I am the author of I18N::Collate, I should know.
It is utterly deprecated, obsolete, dusty.

Nowadays, please use the much more versatile system, locales.
Read the perllocale documentation.

-- 
$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen


------------------------------

Date: 06 Nov 1997 14:41:07 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <lq1vhy5kdyk.fsf@bmerhe83.nortel.ca>

Gary Howland <ghowland@hotlava.com> writes:
> It's not a bug, it's a feature!  There's more than one way to do it!
> 
> This example helps to show what a monster of a language perl really is,
> with unexpected (inconsistent?) behaviour not found anywhere else. The
> follow-ups will demonstrate how the perl community think that this is a
> good thing, all part of perls eclectic nature (as if that is some sort
> of virtue), and how features such as this are certainly more important
> than threads or typed exceptions...
> 
> Three of the following work as expected.  A pint for anyone who can tell
> my which three (without running the code):
> 
> print join(", ", split('|', "hello|world")), "\n";
> print join(", ", split("|", "hello|world")), "\n";
> print join(", ", split(/|/, "hello|world")), "\n";
> print join(", ", split(/\|/, "hello|world")), "\n";
> print join(", ", split("\|", "hello|world")), "\n";
> print join(", ", split('\|', "hello|world")), "\n";
> my $sep = "|"; print join(", ", split($sep, "hello|world")), "\n";
> my $sep = "\|"; print join(", ", split($sep, "hello|world")), "\n";
> my $sep = '|'; print join(", ", split($sep, "hello|world")), "\n";
> my $sep = '\|'; print join(", ", split($sep, "hello|world")), "\n";
> 
> 
> And, yes, I am well aware that some smartarse will point out that this
> is in the documentation, section 9.12.4.5.14.56a, and I should have read
> it before wasting everybody's time with this post.  Time to give Python
> a go I think ...

Go ahead?

mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


------------------------------

Date: 6 Nov 1997 20:11:17 GMT
From: Mike West <westmj@esvax.dnet.dupont.com>
Subject: Re: An excellent example of perl madness (or "split stupidity")
Message-Id: <63t895$74p@topgun.es.dupont.com>

Randal Schwartz, merlyn@stonehenge.com writes:
>>> "Gary" == Gary Howland <ghowland@hotlava.com> writes:
>
>Gary> Three of the following work as expected.  A pint for anyone who can tell
>Gary> my which three (without running the code):
>
>(Five, actually...)
 ...
>
>You just don't seem to realize two things:
>
>	1) the first arg to split is *always* a regex
>	2) the | char is special in a regex
>
>Once you get that down, the yes/no above is easy.  The scary parts for
>me is when you write "\|", which is a two char string, even though the
>backslash usually means "the following char is special" in a string.
>
 ...

Gary says 3, which I see, Randal says 5, which is the wizard's answer...
and I see, but:

I think the third thing not realized is shown by :

print join( ', ', "|",'|',"\|",'\|' ) ;

which is that "\|" returns the same as "|"  and '|' since the
backslash in a double quoted context seems to return the special
meaning or the 'unspecial' meaning in the absence of a special
meaning... in my non-wizard way of thinking... but '\|' is not the
same as '|' since special characters are not returned by single
quotes...

Regards, Mike West mwest@nyx.net


------------------------------

Date: Thu, 06 Nov 1997 13:51:30 -0600
From: kchadha@hotmail.com
Subject: Command line options
Message-Id: <878845488.2938@dejanews.com>

Hi,

I want to do the following:

runprogram.pl -tM1 -tM2

and have an array/variable contain M1 and M2

I normally use getopts('t:') and GetOpt::Std

but that doesn't work if there are two arguments.


Any ideas ?

Please MAIL your replies to kchadha@hotmail.com

Thanks,
Kamal

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 6 Nov 1997 20:15:52 GMT
From: lusol@turkey.cc.Lehigh.EDU (Stephen O. Lidie)
Subject: Re: Command line options
Message-Id: <63t8ho$1mls@fidoii.cc.Lehigh.EDU>

kchadha@hotmail.com wrote:
: Hi,

: I want to do the following:

: runprogram.pl -tM1 -tM2

: and have an array/variable contain M1 and M2

: I normally use getopts('t:') and GetOpt::Std

: but that doesn't work if there are two arguments.


: Any ideas ?

Getopt::EvaP from CPAN handles lists of various types of
command line arguments.


------------------------------

Date: 06 Nov 1997 14:22:37 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: Exact string matches
Message-Id: <lq1200tltdu.fsf@bmerhe83.nortel.ca>

paul@pkamf.demon.co.uk writes:
> I am looking to match the end of a sting exactly ie I want:
>    if($string =~ $anotherstring){
>       do something;
>    }
> This works but matches any bit of $anotherstring to $string e.g.
>    $string = ".baker"; $ anothersting = ".ba";
> and gives a match.  How do I code the test so that the only matches I
> get are for other strings that end in .ba alone?

If you're trying to check suffixes for filenames or something:

    my $string = "funky.ba";
    my $suffix = substr($string, rindex($string, '.'));

    if ($suffix eq '.ba') {
       # do something
    }

To do it with a regexp you would add an "anchor". ($ = end-of-string)
The \Q and \E quote $anotherstring just in case it has ., *, +, etc. in it.

    if ($string =~ /\Q$anotherstring\E$/) {
       # do something
    }

in general you'll find that using regular expressions will sometimes be
cleaner, but substr() etc. will execute faster.

hope this helps,
mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


------------------------------

Date: Thu, 06 Nov 1997 13:48:23 -0600
From: Willie Anderson <willie.anderson@analog.com>
Subject: Extended REs in Perl 5.00401: /x extension failure or bogus code?
Message-Id: <34621F07.22472776@analog.com>

Help me, M(r|s). Perl RE Wizard!

I have the following RE in a program (to elide comments).  The first
statement works.  The second multiline statement, using /x style REs,
fails to work in Perl 5.00401:

#--------------------------------------------------------------------
# This works:
#--------------------------------------------------------------------
$n = ($b =~ s/$a($c_open)(.*?)$c/$s/s);     # $n: 0|1 comments elided

#--------------------------------------------------------------------
# but this doesn't:
#--------------------------------------------------------------------
$n = (                                      # $n: 0|1 comments elided
      $b =~ s/                              # in $b, replace:
              $a                            #   null-width anchor
              ($c_open)                     #   open comment .
              (.*?)                         #   minimal string .
              $c                            #   close comment
             /                              # with:
              $s                            #   the replacement string
             /sx                            # ignore whitespace
      );
#--------------------------------------------------------------------

The message that I get from the interpreter is:
#--------------------------------------------------------------------
Uncaught exception from user code:
        /                                   # in $b, replace:
             (?=^)                          #   null-width anchor
             (#|{|/\*)                      #   open comment .
             (.*?)                          #   mi
        /: unmatched () in regexp at test.pl line 76, <> chunk 1.
main::elide_comments('/*c0*//*c1*/x+=1;/*c2*/^J', '^') called at
test.pl line 194
#--------------------------------------------------------------------


Yes, I'm using -w.  I do get a couple of warnings at the start of the
program (the second seems to say that @ARGV is undefined?)  These seem
unrelated to the problem at hand:
#--------------------------------------------------------------------
Name "main::mop" used only once: possible typo at test.pl line 152 (#1)
Use of uninitialized value at test.pl line 171 (#2)
#--------------------------------------------------------------------

So, what gives?  It looks like the /x extension for REs is busted.  I
could easily be wrong, since I am just learning....

Best regards,
--
Willie Anderson                             Analog Devices, Inc.
DSP Architecture Manager                    8911 N. Capitol of Texas Hwy

Phone: 512-427-1056 / Fax: 512-427-1059     Suite 1300
MailTo:willie.anderson@analog.com           Austin, TX 78759-7203




------------------------------

Date: Thu, 06 Nov 1997 12:42:46 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: extracting values from localtime
Message-Id: <34620FA6.7F24@houston.Geco-Prakla.slb.com>

Bob Maillet wrote:
> 
> Hi,
> 
> I am working with the localtime function and am wondering what is a
> good  way to extract the elements of the localtime output string.  It
> seems that if I use substr I will eventually run into a problem 

Hi.  Camel book, 2nd ed, pg 185:

 ...It's typically used as follows:

($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

 ....


isdst stands for "IS Daylight Savings Time observed", and is a 0/1 flag.

HTH

Dave

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


------------------------------

Date: 06 Nov 1997 14:37:29 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: extracting values from localtime
Message-Id: <lq1yb31ke4m.fsf@bmerhe83.nortel.ca>

Bob Maillet <bobm@tiac.net> writes:
> I am working with the localtime function and am wondering what is a
> good  way to extract the elements of the localtime output string.  It
> seems that if I use substr I will eventually run into a problem because
> month, day, year,etc are not preceeded by a zero when they contain a
> single/double digit.  Any help would be appreciated.

Perhaps you could simply get the array context return value from localtime
instead of the scalar? (Assuming this is the problem)

-- CUT FROM THE MANPAGE --

    localtime EXPR
             Converts a time as returned by the time function to
             a 9-element array with the time analyzed for the
             local timezone.  Typically used as follows:

                 ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
                                                             localtime(time);

             All array elements are numeric, and come straight
             out of a struct tm.  In particular this means that
             $mon has the range 0..11 and $wday has the range
             0..6.  If EXPR is omitted, does localtime(time).

             In a scalar context, prints out the ctime(3) value:

                 $now_string = localtime;  # e.g. "Thu Oct 13 04:54:34 1994"

             Also see the timelocal.pl library, and the
             strftime(3) function available via the POSIX
             modulie.

-- END CUT ---

If the problem is that you have a ctime() formatted string and you want
to convert it back into the broken down pieces... you could try using
a fancy regexp.

hope this helps,
mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


------------------------------

Date: 6 Nov 1997 20:12:45 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Fork workaround for Win32
Message-Id: <memo.19971106201244.28201B@skep.compulink.co.uk.cix.co.uk>

In article <63skkf$a2n$1@due.unit.no>, trygvei@pvv.ntnu.no (Trygve
Iversland) wrote:

> I am writing a small socket server program in perl. I generaly use perl
> under
> unix, and I use fork for multiple connections to the server. I would lik
> e to
> run this script under windows NT too. Is there any way I can get multipl
> e
> processes with perl for Win32? (I know fork() doesn't work :-(   )
>
>

Visit www.cygnus.com and get the cdk32 package.  Gives you a pre compiled
gcc for Win32 - a bash environment - and lots of commonly used unix tools.

Then, you can take the standard perl source tree - and a couple of patches
(I believe these are still wanted for the 5.004_04 release) and run sh
Configure, make depend, make, make test, make install just like you were
at home.

Oh yes, fork() works in this environment. ;-))

I can't off hand remember where you have to get the patch files from.

Regards
Neil



------------------------------

Date: Thu, 06 Nov 1997 14:23:51 -0600
From: schadsey@coralsys.com
Subject: Help with ugly regex
Message-Id: <878847459.5454@dejanews.com>

Well, even if you can't help, you ought to find some humor in this one.

BACKGROUND:

I have a configuration script.	It brings up a menu and allows a user to
enter values for any of a fixed bunch of rules.  Each rule has a certain
allowable format.  For example, MAX_DISK_USAGE is an integer between 0
and 100.  Each rule has a default value, a description message, a regex
pattern for the allowable format, and a usage message if the entry
violates the format.  This is implemented in a hash of hashes type
thingy:

 ....
%rule_h = (
    MAX_DISK_USAGE => {
    default => "90",
    comment => "max mount point usage for which to check\n",
    req     => '^\s*(100|\d{0,2})\s*$',
    "use"   => "0 <= number <= 100\n",
},
 ....etc...
);

So, the way I have this coded, I have a single line for the regex, and it
gets eval'd later in the code so I can check the user's input.	Fair
enough?

THE PROBLEM:

I have a rule that has (needs) a quite flexible format.  The format can be
any combination of the following :

1) word
2) word;word;word...  	# that is, multiple semicolon-separated words
3) word(number)
4) word(number);word(number)...
5) word(number, number, number...)
6) word(number,score number)
7) word(number, number, number..., score number)
8) word(number,number...,score number);word(number,number...,score
number)...

legend:
"word" 		a combo of alphanumeric characters
"number"	any integer
score		literal word "score"
here are examples corresponding to the above numbers:
1) query1
2) query1;query2;miscellaneous;bob
3) joe(12)
4) bob(12);crap(-33)
5) query1(4, 19, -8,4, 1203, -666)
6) mishmash(100, score 12)
7) bart(100,44,-9,55,-12,score 10)
8) duck(9,12,score 2);goose(-3,score 100);fox(8,9,10,11,score 33)
and any combination of the above.

here's my regex that *works* up to a point (should be a single line,no
whitespace):
/^\s*(\s*%?\w+(\((\s*-?\w+\s*,?)*(\s*score\s*\d+)?\))?;)*(\s*%?\w+
(\((\s*-?\w+\s*,?)*(\s*score\s*\d+)?\))?)\s*$/

1 questions:
1) is there a simpler working regex?

Thanks!

--
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~
Steve Chadsey                   <>               schadsey@coralsys.com
I think about closing the door  <>       and lately I think of it more
I'm living well out of my time  <>      I feel like I'm losing my mind
--Black Sabbath                 <> "Falling off the Edge of the World"
^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~^~

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Thu, 06 Nov 1997 16:31:06 +0000
From: Dean Lyons <Dean_Lyons@hp.com>
Subject: HELP! newbie ques: browser says HTTP 501 not supported
Message-Id: <3461F0C9.B0B9141F@hp.com>

I'm running Perl for Win32, build 312, on a NT 4 server, trying to get a
feedback form (HTML) to work, using a Perl script.

When I press the submit button, a page appears that says:
HTTP/1.0 501 Not Supported

Is it something to do with my server or browser(NetscapeCommunicator 4)?

All the paths are correct, and .pl files are associated with Perl.

Any ideas, solutions or further queries?

Thanks.
Dean Lyons



------------------------------

Date: Thu, 06 Nov 1997 20:01:40 GMT
From: faust@wwa.com (Faust Gertz)
Subject: Re: How to send mail w/in Perl program?
Message-Id: <34622120.1491927@news.wwa.com>

On 6 Nov 97 02:01:39 GMT, orourke@grendel.csc.smith.edu (Joseph
O'Rourke) wrote:

>I am using Perl 5.0 on a Unix system, and would like my program
>to send me mail whose body is written from information in
>variables inside the Perl program.  I tried
>
>	system "mail orourke"
>
>which does invoke mail, but then requests the "Subject" and "Body".

While others have suggested opening a pipe to sendmail, I'll put in a
plug for looking at Mail::Mailer module from a CPAN
(http://www.perl.com/CPAN) near you.

Streben nach Wahrheit

Faust Gertz
Philosopher at Large


------------------------------

Date: Thu, 06 Nov 1997 13:44:46 -0600
From: Steve Vandiver <buxx@buxx.com>
Subject: Re: Making script wait
Message-Id: <34621E2D.E8BDB4@buxx.com>

Andrew D. Arenson wrote:
> 
>         I'd like to make my script wait for 5 minutes at a certain
> point. What's the best way to do this?
> 
> --
> Andrew D. Arenson            | http://gc.bcm.tmc.edu:8088/cgi-bin/andy/andy
> Baylor College of Medicine   | arenson@bcm.tmc.edu        (713)  H 520-7392
> Genome Sequencing Center, Molecular & Human Genetics Dept.     | W 798-4689
> One Baylor Plaza, Room S903, Houston, TX 77030                 | F 798-5386


sleep 300


------------------------------

Date: Thu, 06 Nov 1997 12:28:05 -0700
From: Dale Chavez <dale@horizonint.com>
Subject: Passing Variables
Message-Id: <34621A45.D23E6296@horizonint.com>

I've got a Web page that calls a Perl script which in turn, calls
another Perl script.  How can I pass variables from my first script to
my second (or subsequent) scripts?

Thanks,
Dale



------------------------------

Date: 6 Nov 1997 20:12:41 GMT
From: neilb@zetnet.co.uk (Neil Briscoe)
Subject: Re: Perl Build Failure
Message-Id: <memo.19971106201238.28201A@skep.compulink.co.uk.cix.co.uk>

In article <34609E5C.446B@molbio.sbphrd.com>, josepj00@molbio.sbphrd.com
(Jonathan B. Joseph) wrote:

> I am trying to build perl 5.004_04 for Unixware 2.1.2.  I obtained it
> from ftp.perl.org and downloaded latest.tar.gz.
>
> My build attempt is crashing during the linker stage and I get the
> following message:
>
>    dynamic linker : ./miniperl : error opening libperl.so
>    Killed
>
>
>
> Does anyone have any suggestions on how to properly configure the build
> so that I can fix the linker problem and successfully build Perl ?
>

Yup, do a make realclean - and then re-run sh Configure.

When it asks you if you want to build a dynamically linked perl library,
answer in the negative - then it will build a libperl.a instead and all
should be well.  Just means a much larger perl binary.  Ah well.

Regards
Neil



------------------------------

Date: 6 Nov 1997 18:55:59 GMT
From: dsiebert@gate.net (David Siebert)
Subject: Re: Perl, Sendmail, CGI
Message-Id: <63t3rv$1gso$1@news.gate.net>

I am trying to do some auto notification from my website
I have gotten it to work somewhat. But how can I override the Sender value? in 
the header?
In article <345E735A.2A41ED98@sgi.com>, tigger@sgi.com says...
>
>David Siebert wrote:
>> 
>> Does anyone have some good sample code for using sendmail in a perl script?
>
>Depends on what you're trying to do... Are you wanting to invoke
>sendmail directly (ick) or just send mail?  
>
>jamie



------------------------------

Date: 6 Nov 1997 16:48:35 GMT
From: "Jack" <NoSPAMa-jackg@microsoft.com>
Subject: Re: PERL->ADO->SQL
Message-Id: <01bcead3$f624b0d0$a0e4369d@jackg>

Thanks for the constructive reply!

I checked out the site already and all the examples go through ADO using
the connection object with the execute method.  I am suspecting that the
command object (or parmater object) has some problems.  I need to use the
command object in order to create a parameters collection so that I can get
to a stored proc return codes and output parameters.  
I can get this to work in VB but not PERL:-(

Michael Cornelio <cornelio@home.com> wrote in article
<34615F49.A69E9F13@home.com>...
> Jack wrote:
> > 
> > Using PERL WIN32, does anyone have any sample code using the ADO
command
> > object to execute SQL code (preferably an MS SQL stored procedure)?
> 
> Hi Jack (Pun Intended :-)
> 
> You can find ADO->SQL (via ODBC) examples for PerlScript at
> the ActiveState site here ...
>    http://www.activestate.com/reference/aspSamples/index.htm
> If you're using plain-old CGI, you might want to look at
> Win32::ODBC at http://www.roth.net/odbc/
> 
> Hope this helps ...
> 
> ---------------------------------------------------
> Michael Cornelio
> cornelio@home.com
> 


------------------------------

Date: Thu, 06 Nov 1997 19:54:19 GMT
From: killbell@peterboro.net (Drake Cleary)
Subject: Recursive Search and Replace question
Message-Id: <34622053.645863@news.peterboro.net>


Is there any way to make the following command
exclude one or more specific directories???

find . -name '*.html' | xargs perl -pi -e
's/searchtext/replacetext/gm;'

Thanks in advance.


------------------------------

Date: Thu, 06 Nov 1997 14:56:57 -0500
From: "Gary C. New" <gnew@southernvirginia.edu>
Subject: Regular Expressions
Message-Id: <34622109.48D6@southernvirginia.edu>

Trying to send an individuals name through a regular expression that
will make sure the first letter in the First Middle and Last name are
all upper case no matter how they were given.

i.e.,

$first_name  = 'john';
$middle_name = 'alfred';
$last_name   = 'doe';

$first_name  =~ tr/^?[a-z]/^?[A-Z]/;
etc...
etc...

print "$first_name";

John

My question is with regard to the correct regular expression.  I can't
figure it out.

Thank you for any assistance.

gnew@southernvirginia.edu


------------------------------

Date: 6 Nov 1997 20:27:36 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: Regular Expressions
Message-Id: <63t97o$paj@news-central.tiac.net>

In article <34622109.48D6@southernvirginia.edu>,
Gary C. New <gnew@southernvirginia.edu> wrote:
>Trying to send an individuals name through a regular expression that
>will make sure the first letter in the First Middle and Last name are
>all upper case no matter how they were given.
>
>i.e.,
>
>$first_name  = 'john';
>$middle_name = 'alfred';
>$last_name   = 'doe';

>My question is with regard to the correct regular expression.  I can't
>figure it out.

You could abandon regular expressions and say

  $first_name = ucfirst lc $first_name;

which will upper case the first charcacter of $first_name (assuming it's a
letter.)  Correct capitalisation of names is a tricky problem, but this
will do waht you ask if the strings it's fed are similar to those in your
example.

Hope this helps,

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


------------------------------

Date: Thu, 06 Nov 1997 13:16:22 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: simple problem
Message-Id: <34621786.18F@houston.Geco-Prakla.slb.com>

Scott Saddison wrote:
> 
> I'm having difficulties with comparing variables.
> 
> i.e.
> 
> #!/usr/bin/perl
> 
> $a = "this";
> $b = "thisis";
> 
> if ( $a == "$b" ) {
          ^^^
You are using a numerical comparison for 2 strings.
>    print "$a equals $b\n";
> } else {
>    print "huh\n";
> };
> 
> will print "this equals thisis"
> 
> I know this is a simple problem, I searched thru my perl manual but did
> not find a solution.  I appreciate any responses sent.
> 
> Scott (scott@skyenet.net)
> 
> Thanks!

Should be:	if ( $a eq $b)

Second, put #!/usr/bin/perl -w
                            ^^^
on the first line.  This prints out warnings.  On perl5.004_01, it
gives:
Argument "thisis" isn't numeric in eq at test4 line 6.
Argument "this" isn't numeric in eq at test4 line 6.
this equals thisis


HTH

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


------------------------------

Date: 06 Nov 1997 16:10:01 -0500
From: Mark Mielke <markm@nortel.ca>
Subject: Re: simple problem
Message-Id: <lq1sot9k9ue.fsf@bmerhe83.nortel.ca>

Scott Saddison <scotts@mdmgr.com> writes:
> I'm having difficulties with comparing variables.
> i.e.
> #!/usr/bin/perl
> $a = "this";
> $b = "thisis";
> if ( $a == "$b" ) {
>    print "$a equals $b\n";
> } else {
>    print "huh\n";
> };
> will print "this equals thisis"

== is the numeric compare operator. use eq for string compares. i.e.:

   if ($a eq $b) {
      ...
   }

hope this helps!
mark

--                                                  _________________________
 .  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Northern Telecom Ltd. |
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | Box 3511, Station 'C' |
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, ON    K1Y 4H7 |
  markm@nortel.ca  /  al278@freenet.carleton.ca     |_______________________|


------------------------------

Date: Thu, 06 Nov 1997 16:32:43 -0500
From: Henry Hartley <henry@DotRose.com>
Subject: Re: simple problem
Message-Id: <3462377B.1B8697D7@DotRose.com>

As for where to find this in the "book", I would suggest you spend some time
in the "Common Goofs for Novices" section of chapter 8 of "Programming Perl"
(aka Camel).  I can't tell you how much that section helped me when I started
with Perl.

Henry


Dave Barnett wrote:

> Scott Saddison wrote:
> >
> > I know this is a simple problem, I searched thru my perl manual but did
> > not find a solution.  I appreciate any responses sent.
>
> Should be:      if ( $a eq $b)
>





------------------------------

Date: Thu, 06 Nov 1997 16:04:38 -0500
From: Jason Crowther <jason@syrres.com>
Subject: SSLeay from Perl
Message-Id: <346230E5.41C6@syrres.com>

Any one having/had problems using SSLeay to connect to a Netscape
Server?

I've got a script that connects and tries to pass some post variable
stuff to a script on that server and reads back the results to be saved
locally.  It seems to make the connect without any problems, but all I
ever get back is:

>HTTP/1.0 200 OK
>Server: Netscape-FastTrack/2.01
>Date: Thu, 06 Nov 1997 20:12:48 GMT
>Accept-ranges: bytes
>Last-modified: Wed, 05 Nov 1997 20:13:06 GMT
>Content-length: 6484
>Content-type: text/html
>

with nothing else.  Perhaps its not a problem with SSL but my method?
Any ideas?

thanks for any help!

-- 
=====================================================================
Jason J. Crowther                                   jason@pop.cny.com
=====================================================================
Software Engineer
Syracuse Research Corporation ATC
=====================================================================
My sound card has as much memory as my first PC compatible.
=====================================================================


------------------------------

Date: Thu, 06 Nov 1997 16:27:05 -0500
From: brian@mindbendr.com (Brian Mitchell)
Subject: Re: Taking notice of "Use of uninitialisaed value" warnings
Message-Id: <brian-0611971627060001@20934028.bellatlantic.net>

Ben,

Well, here's a "true defination" (straight from the camel's mouth):


Use of uninitialized value

An undefined value was used as if it were already defined.  It was
interpreted as a ""or a 0, but maybe it was a mistake.  To suppress 
this warning, assign an initial value to your variables.


Hope this helps...


Ben (fred@no.spam.leeds.ac.uk) wrote:

> On many occasions, such a warning is generated when one has not
> realised how a particualar Perl construct works or has made an error
> in the analysis of a problem. In such cases, the warning is helpful
> to say the least.

> However, I have found three situations when this warning appears
> otiose:
> 
> 1. When one has deliberately undef'd $/ to slurp a file whole;
> 2. When printing a complete Config;
> 3. When printing the results of dumpvar.
> 
> First, am I doing something wrong to get such warnings in any
> of these situations, and second, is there a recognised way of
> removing them when the undef'ness is known and potentially 
> useful.

B R I A N    M I T C H E L L 
________________________________________________________________

 "Imagination is the eye of the soul..."
 
  -- Joseph Joubert (1754-1824)

________________________________________________________________
"Reflections of my Imagination" - http://www.esva.net/~mitchell/


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V8 Issue 1281
**************************************

home help back first fref pref prev next nref lref last post