[11054] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4654 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 14 18:03:28 1999

Date: Thu, 14 Jan 99 15: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, 14 Jan 1999     Volume: 8 Number: 4654

Today's topics:
    Re: @ARGV and $_ Question <rafiqmateen@netscape.net>
    Re: @ARGV and $_ Question <uri@ibnets.com>
    Re: @ARGV and $_ Question <rick.delaney@home.com>
    Re: @ARGV and $_ Question (Andre L.)
    Re: @ARGV and $_ Question <rick.delaney@home.com>
    Re: [Q] how to check the existence of ^M in a text file <conmara@tcon.net>
    Re: [Q] how to check the existence of ^M in a text file <uri@ibnets.com>
    Re: [Q] how to check the existence of ^M in a text file (Tad McClellan)
    Re: __DATA__ (Abigail)
    Re: Advance Data Structure of Perl 5.0 (Abigail)
    Re: Calculating to Decimal Places (Abigail)
        cat filename | wc -l   perl equivalent <kspence@modes.tc.faa.gov>
    Re: cat filename | wc -l   perl equivalent (Greg Bacon)
    Re: cat filename | wc -l   perl equivalent <uri@ibnets.com>
    Re: cat filename | wc -l   perl equivalent <uri@ibnets.com>
        Connecting to a SQL Server Database ranjeev_s._pamnani@hud.gov
        DBM questions please (Bill Moseley)
    Re: difference in Perl of Win98/Unix ? <allan@due.net>
    Re: Dynamic HASHES :-(( (Abigail)
    Re: Dynamic HASHES :-(( (Bart Lateur)
    Re: Editors (Was: Re: If Larry Wall's listening out the (Steve Lamb)
    Re: FORM to two different CGI? (Abigail)
    Re: Help needed with locking (Bart Lateur)
    Re: how do I fork a subroutine in perl ceison@my-dejanews.com
    Re: leading zeros (Abigail)
    Re: Mapping NT drives within PERL (Larry Rosler)
    Re: max. length of perl regexp <dgris@moiraine.dimensional.com>
    Re: Modules on Novell Netware <keller57@potsdam.edu>
        Multiple Perls in Win 32 (Jim and Paula)
    Re: parse exception with perl/NT <z0f31@ttacs.ttu.edu>
        Pattern matching <moisei@cs.bgu.ac.il>
    Re: Perl Criticism (Bart Lateur)
    Re: Project Assistance (Tad McClellan)
    Re: Running Perl scripts for Macs (Andre L.)
    Re: Search engine help (Abigail)
    Re: Simple Pattern Question - Newbie (Larry Rosler)
    Re: Way to measure memory / performance hits of script? <dgris@moiraine.dimensional.com>
        what would you do? <tavi367@ibm.net>
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Thu, 14 Jan 1999 16:07:51 -0500
From: Rafiq Mateen <rafiqmateen@netscape.net>
Subject: Re: @ARGV and $_ Question
Message-Id: <369E5CA7.682421F0@netscape.net>

Uri Guttman wrote:
> 
> >>>>> "RM" == Rafiq Mateen <rafiqmateen@netscape.net> writes:
> 
>   RM> This is a multi-part message in MIME format.
>   RM> --------------F92FC23E7359E0AEDAA50A97
>   RM> Content-Type: text/plain; charset=us-ascii
>   RM> Content-Transfer-Encoding: 7bit
> 
> don't post with mime. usenet is a text only medium.

My settings do not show MIME format will keep researching thank you.
> 
>   RM> I will answer the $_ answer for you and hopefully I make sense.
> 
>   RM> foreach $i(@one){        }
> 
> $_ has many more uses than just the iterator of foreach loops

True but I didn't want to get too in-depth.

> 
>   RM> for($i = 0; $i <= $#one; $i++) {       }
> 
> this is c code. in perl it is
> 
> foreach $i ( 0 .. $#one ) {}

True actually I learned it in ADA

> 
>   RM> I learned using this step is faster:
> 
> have you benchmarked it?

Read it on one of the perl pages with speed shown of about 15% or more
faster.
> 
>   RM>   $total = $total + $_;   Now the $_ contains the first value in @one
> 
> $total += $_ ;
> 
> is neater and probably faster (fewer perl ops but unbenchmarked)

True but I didn't know the level of person asking question.
> 
>   RM>   print;
>   RM>   # or
> 
>   RM>   print  "\n";
> 
> that will just print a blank line. only a naked print uses $_ by default.

Actually it printed both ways for me.
> 
>   RM> begin:vcard
>   RM> end:vcard
> 
> and there is no need for vcard, EVER. the mail headers and signature
> cover all that crap.
> 
> hth,
> 
> uri
> 
> Thank you for the tip.  I will research the MIME thing now hate to be a non-conformer new to the group.


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

Date: 14 Jan 1999 16:50:10 -0500
From: Uri Guttman <uri@ibnets.com>
To: Rafiq Mateen <rafiqmateen@netscape.net>
Subject: Re: @ARGV and $_ Question
Message-Id: <3967a94j8t.fsf@ibnets.com>

>>>>> "RM" == Rafiq Mateen <rafiqmateen@netscape.net> writes:

  RM> Uri Guttman wrote:
  >> 
  RM> print;
  RM> # or
  >> 
  RM> print  "\n";
  >> 
  >> that will just print a blank line. only a naked print uses $_ by default.

  RM> Actually it printed both ways for me.

i highly doubt that. can you show some code where you set $_ and use
both prints and it prints twice? 

from perlfunc:

=item print FILEHANDLE LIST

=item print LIST

=item print

<snip>
 If LIST is also omitted, prints $_ to STDOUT.


the "\n" is the LIST so $_ should not be printed.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Thu, 14 Jan 1999 22:27:11 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: @ARGV and $_ Question
Message-Id: <369E7104.62AEBB11@home.com>

Brad Askins wrote:
> 
> Tom -
> 
> You may be right. Maybe I should apologize for my comments to Andre. 
> But don't you think a suggestion, such as you gave, would have been 
> more friendly? It is very hard, as you know, to get the tone of an 
> email message or a newsgroup post.

Which is why there are things like smileys, which Andre had on the end
of his suggestion.

> Instead of posting what I guess was suppose to be some kind of humor, 
> a tip or suggestion would have served a much more useful purpose.

I don't see anything wrong with the suggestion of checking the
documentation.  You asked for definitions and examples and that's where
they are found.

You cannot expect anyone to read your mind and know that you were
unsatisfied with the definitions and examples in the docs.

> But I don't think that making me feel belittled over what appeared to 
> be a simple question is the answer either.

No one can *make* you feel belittled.  You must make that choice
yourself.

I saw nothing to indicate that Andre was attempting to belittle you, but
I don't have the special eyeglasses that allow one to read between the
lines that so many others seem to have.

I wish I knew where I could get a pair, so I could remove the bile and
vitriol that my computer seems to insert between the lines of my posts.
And I seem to be missing out on a lot of what others say, as well.

Oh, well.

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Thu, 14 Jan 1999 15:58:59 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: @ARGV and $_ Question
Message-Id: <alecler-1401991558590001@dialup-549.hip.cam.org>

In article <77juan$8ag$1@news.monad.net>, "Brad" <roclimb@yahoo.com> wrote:

> That was incredible help...Thank you so much for answering my question! I
> never thought of reading the documentation...how stupid of me?!
> 
> Don't you think I read the documentation and still didn't quite understand?
> Or are you just some kind of a smart-ass? If you aren't going to be of any
> help just stay out of newsgroups. You aren't helping me or anyone else who
> might have the same question or having the same problem.
> 
> You must be some kind of expert and if that is the case maybe you should be
> writing the documentation or spending your time more wisely by writing code.
> 
> Maybe to feel good about yourself by putting other people down or by stating
> the obvious. I wish you many years of good fortune.
> 
> Once again, cheers Andre, your the best.
> 
> Brad

You asked, "could someone [...] point me in the direction where I can find
good definition and examples."

I pointed you in the direction of the documentation. It was not obvious
that you had read it, as you did not say so in your post.

Why do I get flamed over this? All I said was, "How about... the
documentation? :)" (with the smiley face).

Me thinks someone should lighten up.

Andre


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

Date: Thu, 14 Jan 1999 22:56:02 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: @ARGV and $_ Question
Message-Id: <369E77C4.31E22A0B@home.com>

Uri Guttman wrote:
> 
> >>>>> "RM" == Rafiq Mateen <rafiqmateen@netscape.net> writes:
> 
>   RM> Uri Guttman wrote:
>   >>
>   RM> print;
>   RM> # or
>   >>
>   RM> print  "\n";
>   >>
>   >> that will just print a blank line. only a naked print uses $_ by default.
> 
>   RM> Actually it printed both ways for me.
> 
> i highly doubt that. can you show some code where you set $_ and use
> both prints and it prints twice?

perl  -pe 'print "\n";print;chomp' /etc/passwd

;-)

-- 
Rick Delaney
rick.delaney@shaw.wave.ca


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

Date: Thu, 14 Jan 1999 16:34:39 -0500
From: Ken McNamara <conmara@tcon.net>
To: "Wang, Liming (EXCHANGE:SKPK:1N51)" <wangli@americasm01.nt.com>
Subject: Re: [Q] how to check the existence of ^M in a text file on Unix
Message-Id: <369E62EF.1E76DA46@tcon.net>

Liming,

Try:

$/ = undef;
$allfile = join('',<infile>);
$foundit = $allfile =~ /\cM/;

KenMc

Wang, Liming (EXCHANGE:SKPK:1N51) wrote:

> Hi all,
>
> I am wondering if someone out there can give me a hint on how to detect
> whether a text file on Unix  contains "^M" (i.e., the Control-M
> character). This happens if you use Notepad on NT and save the file,
> store it on Unix.
>
> Thanks for any suggestions.





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

Date: 14 Jan 1999 16:57:00 -0500
From: Uri Guttman <uri@ibnets.com>
To: Ken McNamara <conmara@tcon.net>
Subject: Re: [Q] how to check the existence of ^M in a text file on Unix
Message-Id: <393e5d4ixf.fsf@ibnets.com>

>>>>> "KM" == Ken McNamara <conmara@tcon.net> writes:

  KM> $/ = undef;
  KM> $allfile = join('',<infile>);

since you undef'ed $/ there is no need for the join. you will slurp the
whole file with the first <>.

also use all uppercase for file handles.

  KM> $foundit = $allfile =~ /\cM/;

much faster with tr/\cM// ;

which leads me to a one liner (tested):

perl -0777ne 'print "CR found in $ARGV\n" if tr/\cM//' file

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Thu, 14 Jan 1999 15:24:09 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: [Q] how to check the existence of ^M in a text file on Unix
Message-Id: <p9nl77.hpc.ln@magna.metronet.com>

Wang, Liming (EXCHANGE:SKPK:1N51) (wangli@americasm01.nt.com) wrote:

: I am wondering if someone out there can give me a hint on how to detect
: whether a text file on Unix  contains "^M" (i.e., the Control-M
: character). This happens if you use Notepad on NT and save the file,
: store it on Unix.


perl -ne '$y=1 if tr/\r/\r/; END{print $y ? "yep\n" : "nope\n"}' filename


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 14 Jan 1999 22:08:23 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: __DATA__
Message-Id: <77lpsn$q4j$1@client2.news.psi.net>

James B Crigler (james.b.crigler@lmco.com) wrote on MCMLXII September
MCMXCIII in <URL:news:369DFB12.163AEF6C@lmco.com>:
** 
** Though the docs come with perl, it does not follow necessarily that they
** are available to users.  E.g., I have access to the man pages, but to
** get
** the FAQs, I have to on the web.  (Even at that, the version of perl in
** use
** here is 5.003---multiple years out of date.  Unlike my previous job,
** at this employer I don't have admin privileges.)


If your employer doesn't give you access to the documents you need to
do your job, complain to your employer - don't expect this group to
do your employers job.

Furthermore, you don't need admin priviledges to download the Perl 
distribution and untar it. Then you have access to the documentation.



Abigail


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

Date: 14 Jan 1999 22:11:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Advance Data Structure of Perl 5.0
Message-Id: <77lq1u$q4j$2@client2.news.psi.net>

gip (gibsonc@aztec.asu.edu) wrote on MCMLXII September MCMXCIII in
<URL:news:77ljr9$4kg@bmw.hwcae.az.Honeywell.COM>:
;; # Below is the structure I want to use, based off page 273-274 of
;; Programming Perl.
;; 
;; # I want to know how to assign members' values.  For example, the following
;; is my first try, which doesn't work.  What I want to know is how to set up
;; an assignment statement that would set the fields for a members.

$structures {DUMODE_T} -> {members} -> {size} = 8;



Abigail


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

Date: 14 Jan 1999 21:04:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Calculating to Decimal Places
Message-Id: <77lm4g$pco$1@client2.news.psi.net>

Artoo (r2-d2@REMOVEbigfoot.com) wrote on MCMLXII September MCMXCIII in
<URL:news:77l7p5$l1a$1@plug.news.pipex.net>:
$$ 
$$ How can you calculate something to a certain number of decimal points?  eg:
$$ 2038/58 calculated to two decimal places rather than 14 places.


FAQ


Abigail


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

Date: Thu, 14 Jan 1999 16:11:52 -0500
From: "K. Spence" <kspence@modes.tc.faa.gov>
Subject: cat filename | wc -l   perl equivalent
Message-Id: <369E5D94.1FFFDFD9@modes.tc.faa.gov>


--------------1D95BA3877559AF2BCC3621D
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I need a perl equivalent command for the following:
cat filename | wc -l

Actually, what I really need to do is count all
the lines in the text files in a directory.

like

cat filename.h  && filename.c | wc -l  (kind of)

Thanks,

Kim

--

***********************************************************************
           Spend your life for something that outlasts it.
***********************************************************************

This is my personal opinion and not that of my employer !!!



--------------1D95BA3877559AF2BCC3621D
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
I need a perl equivalent command for the following:
<BR>cat filename | wc -l

<P>Actually, what I really need to do is count all
<BR>the lines in the text files in a directory.

<P>like

<P>cat filename.h&nbsp; &amp;&amp; filename.c | wc -l&nbsp; (kind of)

<P>Thanks,

<P>Kim
<PRE>--&nbsp;

***********************************************************************
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Spend your life for something that outlasts it.
***********************************************************************


This is my personal opinion and not that of my employer !!!</PRE>
&nbsp;</HTML>

--------------1D95BA3877559AF2BCC3621D--



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

Date: 14 Jan 1999 21:40:55 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: cat filename | wc -l   perl equivalent
Message-Id: <77lo97$btp$1@info.uah.edu>

In article <369E5D94.1FFFDFD9@modes.tc.faa.gov>,
	"K. Spence" <kspence@modes.tc.faa.gov> writes:
: --------------1D95BA3877559AF2BCC3621D
: Content-Type: text/plain; charset=us-ascii
: Content-Transfer-Encoding: 7bit

Please don't do that.

: I need a perl equivalent command for the following:
: cat filename | wc -l

    #! /usr/bin/perl -w
    $lines++ while <>;
    print $lines, "\n";

: Actually, what I really need to do is count all
: the lines in the text files in a directory.

    % lines dir/*.txt

Greg
-- 
An authority is a person who can tell you more about something than you really
care to know.


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

Date: 14 Jan 1999 17:02:40 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: cat filename | wc -l   perl equivalent
Message-Id: <39zp7l343j.fsf@ibnets.com>

>>>>> "KS" == K Spence <kspence@modes.tc.faa.gov> writes:

Don't Post HTML or MIME!
you will get better responses without it.

  KS> Content-Type: text/plain; charset=us-ascii
  KS> Content-Transfer-Encoding: 7bit


  KS> I need a perl equivalent command for the following:
  KS> cat filename | wc -l

no need for the cat, that should be:

wc -l filename

  KS> Actually, what I really need to do is count all
  KS> the lines in the text files in a directory.

  KS> cat filename.h  && filename.c | wc -l  (kind of)


what is wrong with using wc if it does the trick? is this in a perl
script or from the command line? 

i will leave the reading of the file as an xercise to you but counting
newlines is simple:

	$line_count = $file_text =~ tr/\n// ;

hth,

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: 14 Jan 1999 17:22:04 -0500
From: Uri Guttman <uri@ibnets.com>
Subject: Re: cat filename | wc -l   perl equivalent
Message-Id: <39yan53377.fsf@ibnets.com>

>>>>> "GB" == Greg Bacon <gbacon@itsc.uah.edu> writes:

  GB>     #! /usr/bin/perl -w
  GB>     $lines++ while <>;
  GB>     print $lines, "\n";

perl -ne 'END{print "$.\n"}' file

i also posted another way with file slurping and tr///.

i think abigail did a very quirky one liner on this a few months
ago. IIR his/hers was even shorter due to some odd trick in hacking with
the -n loop code. s/he knew the way the -n loop code was wrapped around
the body.

uri

-- 
Uri Guttman                             Hacking Perl for Ironbridge Networks
uri@sysarch.com				uri@ironbridgenetworks.com	


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

Date: Thu, 14 Jan 1999 20:55:29 GMT
From: ranjeev_s._pamnani@hud.gov
Subject: Connecting to a SQL Server Database
Message-Id: <77llju$kr8$1@nnrp1.dejanews.com>

Hi,

I am new to Perl and need to write a Perl Script to run a query on MS SQL
Server 6.5 DB and write the results of the query in a file.

How can I do this? I am not aware of any system libraries that might be
required. Please let me know if there are some sample scripts for this purpose
which would help me a lot.

Thanks in advance,
Ranjeev

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Thu, 14 Jan 1999 14:33:22 -0800
From: moseley@best.com (Bill Moseley)
Subject: DBM questions please
Message-Id: <MPG.11081088120b2495989685@nntp1.ba.best.com>

I'm working with a small relational database -  three or four related 
files, with just a few hundred or so records.  Nothing to big.

1) My target system doesn't have DB_File installed.  If I use 'exists' to 
check a key in a dbm I get "AnyDBM_File doesn't define an EXISTS method"
Is "defined $tied_hash{key}" the way to check if a key exists w/o 
DB_File?

(Can undefined values be stored in a dbm tied hash?)

2) Is there a reason that I need to use DB_File instead of AnyDBM_File? 
The database will stay on the target machine, and I don't need any 
special features of the other DBMs.

3) How do I check for write errors when using a DBM tied hash?
   $tied_hash{key} = 'hello!' or die "a terrible death $!"?

4) Any suggestions on transaction processing?  I've got a relational 
database with three database files.  What if the last write of a multi-
write operation fails?  Any suggestions on how to clean up to the 
previous state in all the files?

5) In my database, I don't really care about the keys so any reason not 
to just use a counter to generate unique keys?  I guess the question is 
really, what's a good method to generate unique keys? (darn, that's FAQ 
question)
     
    1 while exists $tied_hash{ ++$tied_hash{'counter'} };
or
    $new_record_key = (keys %tied_hash) + 1;


Thanks so very much,


-- 
Bill Moseley mailto:moseley@best.com


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

Date: 14 Jan 1999 21:32:27 GMT
From: "Allan M. Due" <allan@due.net>
Subject: Re: difference in Perl of Win98/Unix ?
Message-Id: <77lnpb$7ij$0@206.165.165.157>

jkang@nyph.org wrote in message <77li7n$hv8$1@nnrp1.dejanews.com>...
:Hi, All.
:Here is a Perl/newbie's code in Windows 98.
:###
:   print "enter three lines of strings : \n" ;
:   @STRINGS = <STDIN> ;
:   print @STRINGS ;
:   print "@STRINGS" ;
:   print reverse (@STRINGS) ;
:the code above produce this output with input of "first", "second", "third"
:on separate lines ending with fourthline of ^Z.
:omitting line 1 and 2 from the code above,

:second
:third
: second
: third
:third
:second
:first


That would suprise me, the problem in Windoze is usually that the very first
print with an ending \n is lost when one is reading data from STDIN and ending
with a Cntrl-Z.  So I bet that "first" is there in the second set; it is there
when I run the scriptlet.

:You would notice there is a initial space character for line 3 and 4.
:Aren't they supposed to produce the same output?

The spaces are expected under both UNIX and Winhoze when you double quote the
array.

:And Why the $STRINGS[0]
:is omitted in the output and not omitted in the reversed array?


Why? I don't know.  I don't think it is a feature <g>.  The only way to avoid
this problem that I have found is to always start with a \n.

HTH

AmD




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

Date: 14 Jan 1999 21:05:38 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Dynamic HASHES :-((
Message-Id: <77lm72$pco$2@client2.news.psi.net>

Stefan Nonneman (stefan.nonneman@cec.be) wrote on MCMLXII September
MCMXCIII in <URL:news:369E2B51.C2DAD817@cec.be>:
## Is it possible to append data pairs to existing hashes when a key is not
## found?

   $hash {key} = $value unless exists $hash {key};




Abigail


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

Date: Thu, 14 Jan 1999 22:08:25 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Dynamic HASHES :-((
Message-Id: <36a168e5.5145538@news.skynet.be>

Stefan Nonneman wrote:

>Is it possible to append data pairs to existing hashes when a key is not
>found?
>From the documentation it is not clear to me.

What do you mean?

	push @{$hash{$key}}, { some => hash };

Yup, that works.

But, as Randal said before (this week?), $hash{$key} better didn't
contain a scalar.

	Bart.


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

Date: 14 Jan 1999 13:34:12 +0800
From: morpheus@no-spam.calweb.com (Steve Lamb)
Subject: Re: Editors (Was: Re: If Larry Wall's listening out there....)
Message-Id: <slrn79somd.24e.morpheus@rpglink.com>

On 6 Jan 1999 10:22:55 -0500, Clay Irving <clay@panix.com> wrote:
>if (talk_about($editor_preference)) {
>    print "The subject has been discussed to death.\n";
>    die "A horrible death.\n";
>}

    It isn't so much editor preference but the point that he should be using
an editor that does the job instead of asking perl to be changed.  As many
people have said, there are many free replacements that do do the job and
I'm willing to wager even use the same keystrokes as notepad.

-- 
             Steve C. Lamb             | Opinions expressed by me are not my
    http://www.calweb.com/~morpheus    | employer's.  They hired me for my
             ICQ: 5107343              | skills and labor, not my opinions!
---------------------------------------+-------------------------------------


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

Date: 14 Jan 1999 21:06:43 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: FORM to two different CGI?
Message-Id: <77lm93$pco$3@client2.news.psi.net>

Gleb Ekker (globus@infonet.ee) wrote on MCMLXII September MCMXCIII in
<URL:news:369E089E.F93FE52@infonet.ee>:
() Hi,
() 
() Please help me!  I have FORM on my page which is need to be sent to two
() different CGI scripts on two different servers.  Is it possible to put
() two URLs in <FORM ACTION=...>,  or there is some other way to fix this
() problem?


That's not a Perl question. Try a more appropriate group, like
finet.freenet.oppiaineet.vieraat-kielet.keskustelu.



Abigail


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

Date: Thu, 14 Jan 1999 22:08:22 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Help needed with locking
Message-Id: <36a067c8.4860807@news.skynet.be>

info@gadnet.com wrote:

>What happens if
>you open a file for reading which is currently held with an flock (2)
>for writing? Will the open work, even if you can't then read the file?

Unless I am *very* wrong:

"open" will work, but flock(2) will *wait* until the file is unlocked or
(preferably) closed on the other side.

	Bart.


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

Date: Thu, 14 Jan 1999 21:36:33 GMT
From: ceison@my-dejanews.com
Subject: Re: how do I fork a subroutine in perl
Message-Id: <77lo11$ms4$1@nnrp1.dejanews.com>

sorry - dejanews was using an old email address -
my new one is ceison@computers4all.com

In article <77jkt8$uk2$1@nnrp1.dejanews.com>,
  ceison@lis.net.au wrote:
> Hi, I am writing a perl script that connects to a server and answers requests
> from that server. However I am having a problem where perl is buffering the
> requests while dealing with 1 request at a time.
>
> I was wondering if there is a way to fork a subroutine in perl allowing it to
> use the same port as the main script.
>
> The only forking example I have found is to do with servers in the perlipc
> doc, but I need a client to fork its subroutines so that each request from
> the server is delt with there and then without being buffered by perl.
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 14 Jan 1999 21:07:44 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: leading zeros
Message-Id: <77lmb0$pco$4@client2.news.psi.net>

studmail (studmail@dutwmail.wbmt.tudelft.nl) wrote on MCMLXII September
MCMXCIII in <URL:news:369E2918.108734D0@dutwmail.wbmt.tudelft.nl>:
$$ 
$$ How to print numbers to a file with leading zeros?


printf


Abigail


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

Date: Thu, 14 Jan 1999 13:13:09 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Mapping NT drives within PERL
Message-Id: <MPG.1107fdbeaf97a272989990@nntp.hpl.hp.com>

In article <77lk5g$joq$1@nnrp1.dejanews.com> on Thu, 14 Jan 1999 
20:30:40 GMT, mirak63@my-dejanews.com <mirak63@my-dejanews.com> says...
> I have been unsuccessfully trying to map to an NT network drive using the
> following syntax...  system("net use t: \\\$server\\d$");

You are short one backslash.  You want to get two backslashes ahead of 
the interpolated variable $server.  What you actually have is one 
backslash, a dollar sign, and the string 'server'.

As you could have discovered by replacing 'system' by 'print' in the 
above statement, instead of posting here and waiting for a response.

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 14 Jan 1999 13:54:16 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: max. length of perl regexp
Message-Id: <m3pv8h379j.fsf@moiraine.dimensional.com>

Ala Qumsieh <aqumsieh@matrox.com> writes:

> s_jagadish@yahoo.com writes:

> > is there a limit on the max. length of a regexp ? if so what is it ?

> Nope ... and to prove it, get a copy of the Owls book (Mastering
> Regular Expressions, by Jeffrey Friedl) and open page 316.
> There, he lists a regex that is 6,598 bytes long for verifying email
> addresses.

I hardly think that a single 6k example can be held up as proof that
perl regular expressions have no limits.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Thu, 14 Jan 1999 15:58:42 -0500
From: Matthew Keller <keller57@potsdam.edu>
To: virgil <horst.k@netway.at>
Subject: Re: Modules on Novell Netware
Message-Id: <369E5A82.63216E14@potsdam.edu>

virgil wrote:
> 
> hi there,
> does somebody know how i can install a cpan-module on a netware machine?

	Sure... You may need to re-compile Perl, but it works (Netware 5 I
assume?)
-- 

             -> Matthew Keller <-
            Distributed Computing
             Windows/UNIX Support
              and Host Services
                 Kellas Hall
   State University of New York at Potsdam	
         http://mattwork.potsdam.edu/
-
     They wouldn't give you the time of day.
     They said you weren't a player.
     They wouldn't accept your calls.
     They are holding on line three.
-
 PGP Keys -
    http://mattwork.potsdam.edu/crypto/


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

Date: Thu, 14 Jan 1999 22:31:00 GMT
From: gemhound@gemhound.com (Jim and Paula)
Subject: Multiple Perls in Win 32
Message-Id: <369e6fe6.9955988@news.primeline.com>

While learning Perl for win 32, I've done my share of infinite loops,
sometimes on purpose, and it's easy enough to end them with
ctrl-break.  But I noticed when using ctrl-alt-del to look at running
programs that some perl process still kept running.  If I screw up
enough, I can have five or six "perls" running when I look at the
ctrl-alt-del popup screen, which considerably slows my system.  Other
non-infinite-loop perl programs that just freeze for one reason or
another give the same result.  Just a warning.  If you are
experimenting and ctrl-breaking out of stuck perlprogs in win 32,  and
your system is crawling, hit ctrl-atl-delete and see if there are
multiple perls still running.


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

Date: Thu, 14 Jan 1999 15:25:46 -0600
From: Larry Siron <z0f31@ttacs.ttu.edu>
Subject: Re: parse exception with perl/NT
Message-Id: <369E60DA.EDE57E00@ttacs.ttu.edu>

Emil Rivas wrote:
> I am having difficulty in trying to launch a perl script from a remote NT
> station through a shared drive.  Perl script runs fine on the local NT
> machine and can be fired up via a batch file fine from that local machine
> through the batch file.

I was sysadmin on a homogeniously Micro$oft network for a while, and was
attempting the same type of deal.

I wanted to run a perl program inside the logon batch script, using the
perl interpreter installed on the server (instead of putting it on every
PC in the network).

But, you can't just run the perlexe.  The perl executable apparently
depends on a good deal of extranneous data, (IE .dll's), and maybe these
can be pointed to somewhere in the registry?  Err... I don't know.

What I'm trying to say is that I ended up giving up and finding another
way to do it.  Hopefully you can, too. Would it be impossible to have
perl installed on both machines?  That sounds a nice solution, although
you won't learn anything that way. (Then again, if it's education you
want, fdisk and install LinuX =) ).

-Ryan King
(On a borrowed PC, Too lazy to change configs, so if you want to E-Mail
my catch-all addr is corrieandryan@hotmail.com)


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

Date: Thu, 14 Jan 1999 23:25:05 +0200
From: Moisei Rabinovich <moisei@cs.bgu.ac.il>
Subject: Pattern matching
Message-Id: <369E60B1.552E2C6C@cs.bgu.ac.il>

Shalom,
I want to cut of the some sql file the procedure with specified name and
all the comments that comes before it.
The structure of the file is like :

<--------skip---------->
comments1
 .............
if exists proc1
 ...............
go
create procedure proc1
 ..................
go
comments100
 .............
if exists proc100
 ...............
go
create procedure proc100
 ..................
go
comments101
<------skip---------->

So for proc100 i want get :
<----->
comments100
 .............
if exists proc100
 ...............
go
create procedure proc100
 ..................
go
<------>

I try this re :
$spName="proc100";
$mainText =~
s/\s*go\s*\n(.|\n)*?\s*if\s*exists.*$spName.*\n(.|\n)*?\s*create\s*procedure\s*$spName.*\n(.|\n)*?\s*go\s*\n//i;

but it returns all the text between the FIRST "go" of the file and the
last "go" of the procedure.
Is there the way to say "the last "go" before procedure definition"?
May be "all the strings after "\s*go\s*\n" that not match "\s*go\s*\n"?
Or something like this ?

Thank you.
                            Moisei.





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

Date: Thu, 14 Jan 1999 21:21:13 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Perl Criticism
Message-Id: <369f5fa8.2780852@news.skynet.be>

topmind@technologist.com wrote:

>> >> Anyway, that's how *I* found Perl, Python and TCL, more than 5 years
>> >> ago. They weren't the "hot items" then. Funny how my preferences of that
>> >> time eventually made it into popularity...
>> >>
>> >> 	Bart.
>> >
>> >You should have bought stocks intead, then you would not
>> >need ANY language :-)
>>
>> You can buy stockes in perl?
>
>I meant use your alleged gift at prediction to make
>money picking the winners (growth markets) in general.

Hey, I didn't say I thought it would *sell*. I still doubt, even now,
whether most users would be prepared to pay, say, 150$ for their first
Perl package.

But the fact that quite of few of my favorites were picked up, may well
indicate that quite a few people want pretty much the same thing from a
computer language as I do:

 1) Simple, so you don't have to try too hard to remember how to work
with it (or, as in Perl, with a workable subset of it).
 2) Powerful. I hate to bump into relatively simple problems, where the
only reply is "you can't do that".
 3) Redundancy. I hate redundancy. And verbosity. Having to type the
header line of functions twice, or the necessity for elaborate
declarations for relatively brainless stuff, those things really turn me
off.

Also:
 4) Lack for risk for subtle bugs. Things that blow up in your face,
without much of an apparent reason. See the running advertisements for
PC-Lint in DDJ, and you'll see part of why C isn't in my favorites list.
 5) Interactivity. Ease of testing and debugging. A fast turnaround
(edit/compile/run) cycle is desirable.
 6) Lightweight and fast. I really hate IDE's that take minutes to
launch and take up all the available computer resources. And, if simple
compiled programs take megabytes of disk space and/or memory, or are
remarkably slow, then I won't use it too much, no matter how I like the
language. Sorry.

	Bart.


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

Date: Thu, 14 Jan 1999 15:40:32 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Project Assistance
Message-Id: <g8ol77.hpc.ln@magna.metronet.com>

juldex@yahoo.com wrote:
: I am a final year engineering student and I have asenior project to complete
: to get my BSc. My project involves web programming and I could really use
: some advice and assistance. The heart of the project is that it is an on line
: tutorial to teach students about telephone circuit switching. It is to have
: animation showing how the switching is done and interactivity so that the
: user can perform simulations on the network, by inputting different network
: characteristics or the time of day when a call is made. 


   What is your Perl question?


: If anyone out there
: has any experience with this kind of thing please email me. 


   Try using some carefully selected terms in a search engine.


: It's a life and
: death situation.


   That last sentence hurts your credibility...


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: Thu, 14 Jan 1999 16:18:07 -0500
From: alecler@cam.org (Andre L.)
Subject: Re: Running Perl scripts for Macs
Message-Id: <alecler-1401991618070001@dialup-549.hip.cam.org>

In article <comdog-ya02408000R1401990149100001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:

> In article <369D12CE.1FCE5F55@home.com>, jasongadde@home.com posted:
> 
> > Does anyone know that if a script is able to run in a Windows
> > environment, can it also be run in a Mac environment? Is there any major
> > differences (ie. with Regular Expressions, special characters,
> > functions) in the actual scripts itself.
> 
> Perl is Perl.  if you do something non-Perl, then there might be a
> problem.

 ...except for a few details. 

For instance, Mac filepaths use ':' instead of '/'. This is a major gotcha
when dealing with files/directories.

In MacPerl, certain functions that run well on Unix, such as flock(), are
not implemented and cause premature termination of the program.

Certains values returned by stat() are not relevant under MacOS.

The value of "\n" (as well as the default value of $/) is actually "\015"
(carriage return).

Little things like that. Like tim says, about 98-99% of core Perl is truly
cross-platform. Not bad at all.

Andre


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

Date: 14 Jan 1999 22:15:24 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Search engine help
Message-Id: <77lq9s$q4j$3@client2.news.psi.net>

Mind Logic (mike@mindlogic2.com) wrote on MCMLXII September MCMXCIII in
<URL:news:369e490b$0$16677@nntp1.ba.best.com>:
?? I'm using the Simple Search Perl script 
?? from http://www.worldwidemart.com/scripts/ and have encountered a problem. 
?? I've successfully chmoded everything, and have changed all the variables (or 
?? at least I think I have) to reflect the server. Here's my variables.
?? 
?? $basedir = '/htdocs';
?? $baseurl = 'http://209.240.134.108/';
?? @files = ('*.shtml','*.html');
?? $title = "Mind Logic";
?? $title_url = 'http://209.240.134.108/';
?? $search_url = 'http://209.240.134.108/search.html';
?? 
?? The URL for the script is at http://209.240.134.108/search.html (you can use 
?? multistandard.com too but the domain names isn't supposed to clear for 
?? another 7 hours about).
?? 
?? There's currently only two files on the server at 
?? http://209.240.134.108/index.shtml and http://209.240.134.108/test.html but 
?? when I type in something like test nothing shows up in the search results.
?? 
?? Anyone know a solution to this?


There must be a bug in line 17.



Abigail


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

Date: Thu, 14 Jan 1999 13:06:48 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Simple Pattern Question - Newbie
Message-Id: <MPG.1107fc449eaf6a9b98998f@nntp.hpl.hp.com>

In article <0Wrn2.496$aA6.1482@news.get2net.dk> on Thu, 14 Jan 1999 
20:06:41 +0100, Thomas Turn Jensen <Mukke@get2net.dk> says...
> @List = split/\&1/,$a;

This splits on the string '&1', which is not what was requested (split 
on '\&').  The correct pattern (because regexes are essentially double-
quoted) is /\\&/ .

($a, $b, $c, $d) = split/%\1/,$a;

That pattern bears even less resemblance to what was requested.

You posted without testing.  Fie...

-- 
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 14 Jan 1999 14:06:58 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: Way to measure memory / performance hits of script?
Message-Id: <m3lnj536od.fsf@moiraine.dimensional.com>

Eugene Sotirescu <eugene@snailgem.org> writes:

> Andrew M. Langmead wrote:
<snip list of common errors that lead to slow execution>
> > And there are a zillion others.

> Maybe not zillions, but here's another big one:
> 
> combining backreferences with multiple wildcards in regular expressions

That one doesn't really count, though, as it isn't always a mistake.
There are a lot of problems where need [+*] and backreferences are
absolutely essential.

dgris
-- 
Daniel Grisinger          dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print 
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'


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

Date: Thu, 14 Jan 1999 15:18:47 -0600
From: "walter" <tavi367@ibm.net>
Subject: what would you do?
Message-Id: <369e5f9c.0@news1.ibm.net>

I have 2 possible ways of doing something (Sample A and B below).

I would like to know which you you use any why.

Thanks

Walter

=========================

Sample A :      chr ( hex $sample )

=========================

Sample B :      pack ( "c", hex($sample ) )

=========================


====================================================================
The software required `Windows 95 or better', so I installed Mac OS.
 -- Remember: Win 95/98 = Mac 84 = GS 80 = Xerox 72





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

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


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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 4654
**************************************

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