[9908] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3501 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Aug 21 13:07:43 1998

Date: Fri, 21 Aug 98 10:00:24 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 21 Aug 1998     Volume: 8 Number: 3501

Today's topics:
    Re: binding operator (=~) with variables ? huntersean@hotmail.com
    Re: binding operator (=~) with variables ? huntersean@hotmail.com
    Re: Coderef as hash-index (Chris Russo)
    Re: Converting to lowecase (Michael J Gebis)
    Re: eq and == difference >>Abigail -> You are a LOSER.  (I R A Aggie)
    Re: eq and == difference >>Abigail -> You are a LOSER.  (Honza Pazdziora)
        file upload problem under nt <emoritz@newfangledideas.com>
    Re: Followup: why doesn't this work as expected... huntersean@hotmail.com
        Getting the 500 series error in IIS 4.0 charettec@my-dejanews.com
    Re: Is Perl5.004 Year 2000 compilant? alexk@appliedtheory.com
    Re: Is Perl5.004 Year 2000 compilant? (I R A Aggie)
    Re: Is Perl5.004 Year 2000 compilant? (I R A Aggie)
    Re: Locking files on Window 95 server scott@softbase.com
        logfile analysis <ronan.collins@heanet.ie>
    Re: logfile analysis (Josh Kortbein)
    Re: LWP::Simple Question (Josh Kortbein)
        Mistake (Was: Re: Help: Problem with Pattern-Matching) <mooneer@earthlink.net>
    Re: Mistake (Was: Re: Help: Problem with Pattern-Matchi <ajohnson@gpu.srv.ualberta.ca>
    Re: Perl on linux <dean_darlison@dial.pipex.com>
    Re: Perl on linux (YoYo)
    Re: Perl on linux <lbenfie1@s_p_a_m.ford.com>
        Question: How to <BR> (Alex Kovalenko)
    Re: Reading from files (Josh Kortbein)
    Re: regex question: striphtml and misformed tags patrick@cre8tivegroup.com
    Re: regex question: striphtml and misformed tags (Abigail)
    Re: Search of Large files (Josh Kortbein)
    Re: Send cmd and Receive result from command? (Josh Kortbein)
    Re: swap words in regexp <dgris@rand.dimensional.com>
    Re: system commands huntersean@hotmail.com
        Testing for socket disconnection <jgoldberg@dial_put-a-decimal-here_pipex.com>
    Re: vim - printing on DOS/Windows (Sven Guckes)
    Re: what is 'sub f () {555};' Thanks! <joneil@cks.ssd.k12.wa.us>
    Re: what is 'sub f () {555};' (Josh Kortbein)
    Re: what is 'sub f () {555};' (Josh Kortbein)
    Re: what is 'sub f () {555};' (Abigail)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 21 Aug 1998 15:43:53 GMT
From: huntersean@hotmail.com
Subject: Re: binding operator (=~) with variables ?
Message-Id: <6rk4jp$l3g$1@nnrp1.dejanews.com>

In article <35DD624D.E121ACE4@inapg.inra.fr>,
  Jehan.Procaccia@inapg.inra.fr wrote:
> I want to match a pattern in a string line using a variable as the
> pattern:
>
> $line="hello disney";
> $line2="hello happydisneyland";
> $var="disney";
> if ($line =~ /$var/)
>     then .... # match is OK :-)  this is what I want
>
> if ($line2 =~ /$var/)
>     then .... # match is also OK   :-(  this is not what I want
>
> I want an exact match
>
> I am trying to use pattern matching operators like "starting with" : ^
> operator and "ending with" $ operator but it doesn't seem to work while
> using a variable in the pattern:
> $line =~ /^$var/
> $line =~/^$$var/ .... nothing works :-(
>
> jehan@inapg.inra.fr
>
>
You probably want something like:

if ($line =~ /$var/) and !($line2 =~ /$var/) {
       #Hooray!
       ...

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 21 Aug 1998 15:45:44 GMT
From: huntersean@hotmail.com
Subject: Re: binding operator (=~) with variables ?
Message-Id: <6rk4n8$lju$1@nnrp1.dejanews.com>

In article <35DD624D.E121ACE4@inapg.inra.fr>,
  Jehan.Procaccia@inapg.inra.fr wrote:
> I want to match a pattern in a string line using a variable as the
> pattern:
>
> $line="hello disney";
> $line2="hello happydisneyland";
> $var="disney";
> if ($line =~ /$var/)
>     then .... # match is OK :-)  this is what I want
>
> if ($line2 =~ /$var/)
>     then .... # match is also OK   :-(  this is not what I want
>
> I want an exact match
>

Eek! I forgotb about !~.  You want

if ($line =~ /$var/) and ($line2 !~) {
 ....

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 21 Aug 1998 08:39:33 -0700
From: news@russo.org (Chris Russo)
Subject: Re: Coderef as hash-index
Message-Id: <news-2108980839330001@buzz.hq.alink.net>

In article <6rio6l$10a$3@client3.news.psi.net>, abigail@fnx.com wrote:

>Uhm? What do you mean? References *can* be stringified. That's exactly
>what's happening here.

My bad, you're correct.  They can be stringified.  My meaning was that
once they're stringified, they're useless as references, since they can't
be converted back into the data to which they refer.

Regards,

Chris Russo

-- 
Chris Russo
news@russo.org
http://www.russo.org


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

Date: 21 Aug 1998 15:56:44 GMT
From: gebis@fee.ecn.purdue.edu (Michael J Gebis)
Subject: Re: Converting to lowecase
Message-Id: <6rk5bs$it7@mozo.cc.purdue.edu>

mjtg@cus.cam.ac.uk (M.J.T. Guy) writes:

}Scott Erickson <Scott.L.Erickson@HealthPartners.com> wrote:
}>Not necessarily true. The sysadmin who installed Perl on my system,
}>for whatever reason, did not install perldoc. Eventually it was
}>installed, but, please, do not assume that if you have perl, you have
}>perldoc

}But the standard install procedure always installs perldoc (at least on
}Unix platforms  -  dunno about the rest).    So if you don't have
}perldoc, you don't have a correctly installed Perl.

How can people miss perldoc?

Install perl to /opt/weird/stuff/perl
ln -s /opt/weird/stuff/perl /usr/bin/perl5

That's how.  (I'm not defending it, but that's how it happens.)
perldoc is on the system, but it's not in the path.


-- 
Mike Gebis  gebis@ecn.purdue.edu  mgebis@eternal.net


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

Date: Fri, 21 Aug 1998 12:31:12 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: eq and == difference >>Abigail -> You are a LOSER. Take that stick out of your ass!
Message-Id: <fl_aggie-2108981231120001@aggie.coaps.fsu.edu>

In article <6ripit$5us$1@lennon.postino.com>, falstaff@lennon.postino.com
(John) wrote:

+ Oh, don't mind our Abbey. She's just the news group pit bull, 
+ and like Pavlov's dog, when she sees a newbie post a question 
+ answered in the FAQ, she starts frothing at the mouth. 

The question in question isn't in the FAQ - that I could find, anyway. 
Its covered in the basic documentation, tho, and that's what the original
poster should be reading up on.

Or do you disagree?

James


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

Date: Fri, 21 Aug 1998 16:49:49 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: eq and == difference >>Abigail -> You are a LOSER. Take that stick out of your ass!
Message-Id: <slrn6tr99d.odk.adelton@aisa.fi.muni.cz>

On Sun, 16 Aug 1998 05:28:24 GMT, Kermit the frog <kermit@sesamestreet.com> wrote:
> Why are you so fucking bitchy, loser??? In fact, it seems as though
> 3/4 of the people in this fucking group get off on slamming people
> like this guy asking an innocent question. Typical snobbish behaviour

What was bitchy about the answer? It went straight to the point --
if there is something about docs that is unclear, it should be fixed.
The only thing we cannot fix is that fact that people do not read
them.

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
                   I can take or leave it if I please
------------------------------------------------------------------------


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

Date: Fri, 21 Aug 1998 11:00:40 -0700
From: Enrico Moritz <emoritz@newfangledideas.com>
Subject: file upload problem under nt
Message-Id: <35DDB5C8.A6ACA5D@newfangledideas.com>

Hi, I am currently trying to upload a file on a NT maschine.
It works under Linux excellent but not under NT.

Here is the code I'm using: 
#--------------------------------------------------------------------------------
#!/usr/bin/perl

use CGI;
$query = new CGI;

print $query->header;
&do_prompt($query);
&do_work($query);
&print_tail;

sub do_prompt {
    my($query) = @_;

    print qq|
	<H1>File Upload</H1>
	Select the <VAR>browse</VAR> button to choose a text file
	to upload.  When you press the submit button, this script
	will show the content of the file.
    |;

    # Start a multipart form.
    print
#        $query->start_multipart_form,	###<- this work under Linux
without any problem
        $query->start_form,		###<- this works under NT, but the browser
didn't 
					###   show me the content of the file
        "Enter the file to process:",
        $query->filefield(-name=>'filename',
                          -size=>30),"<BR>",
        $query->reset,$query->submit(-label=>'Process File'),
        $query->end_form;
}

sub do_work {
    my($query) = @_;
    if ($file = $query->param('filename')){
        print "<HR>\n";
        print "<H2>$file</H2>\n";
        while (<$file>) {
            print ">$_";
        }
    }    
}

sub print_tail {
    print $query->end_html;
}
#--------------------------------------------------------------------------------

I tried already some other scripts, but under NT the browser uploaded
only 40 KB 
of each file.

Is there anybody who had already the same problem???

Thanks in advance for any help. 
Enrico

mailto:morris@hell.wh8.tu-dresden.de


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

Date: Fri, 21 Aug 1998 15:53:53 GMT
From: huntersean@hotmail.com
Subject: Re: Followup: why doesn't this work as expected...
Message-Id: <6rk56i$lra$1@nnrp1.dejanews.com>



> I'm finding it very difficult to test this cause or the escaping of
> characters. What I'm trying to do is compare the ip address returned from
> REMOTE_ADDR with a stored ip address. The REMOTE_ADDR contains all the
> relevant chars escaped (I understand)
>
> Thanks for any input
> Terry

Have you tried quotemeta (like I said)?

$a = "a.b.c";
$safe_a = quotemeta($a);  # safe_a contains a\.b\.c

$b = "a.b.c|d.e.f";
$safe_b = quotemeta($b);  # safe_b contain a\.b\.c\|d\.e\.f

Regards

Sean Hunter



-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 21 Aug 1998 15:25:01 GMT
From: charettec@my-dejanews.com
Subject: Getting the 500 series error in IIS 4.0
Message-Id: <6rk3gd$j4u$1@nnrp1.dejanews.com>

I'm having a problem running CGI scripts properly. We are running a web server
from IIS 4.0, part of BackOffice for Small Business. I have my CGI scripts
located in the \INETPUB\SCRIPTS directory with Everyone Full Control. I
associated .CGI with PERL.EXE and they are located in the same directory. The
library file CGI has the extension .CGI. The script I am trying to run is:

 # CGI script using CGI.pm module.
 #
 use CGI;

 $form=new CGI;

 #
 #
 $orderno=$form->param('orderno');

 #print form header.
 print $form->header;

 print $form->start_html(
  -title=>'Customer Order Tracking Page'.
  -BGCOLOR=>'white');

 # HTML body
 #
 print "<h1>Your Order Number</h1>\n";
 print "<p>\n"; # paragraph

 # End HTML form.
 print $form->end_html;

 # ordrtrck.cgi




I get the error "500 This is not a Windows NT application". Now I did remember
to change the following in the CGI.CGI file:




 # ------------------ START OF THE LIBRARY ------------

 # CHANGE THIS VARIABLE FOR YOUR OPERATING SYSTEM
 # $OS = 'UNIX';
 # $OS = 'MACINTOSH';
 # $OS = 'WINDOWS';
  $OS = 'NT';
 # $OS = 'VMS';

 # Some OS logic.  Binary mode enabled on DOS, NT and VMS
 $needs_binmode = $OS=~/WINDOWS|NT|VMS/;




I have tried renaming files, putting them in different locations and the
like. And I verified that IIS 4.0 had the directory listed in the WWW
settings.  Does anyone have any ideas?

Thanks,
Chris

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 21 Aug 1998 15:30:34 GMT
From: alexk@appliedtheory.com
Subject: Re: Is Perl5.004 Year 2000 compilant?
Message-Id: <6rk3qq$k1o$1@clarknet.clark.net>

Jeff Gao <jeff_gao@bctel.net> wrote:
: Does anybody know that whether perl 5.004 is y2k compilant?

Yes, but it is not Y2.38K compliant.

: Thanks


: --
: Jeff Gao





--
Alex Kamantauskas
alexk@fz.tugger.net



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

Date: Fri, 21 Aug 1998 12:31:37 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is Perl5.004 Year 2000 compilant?
Message-Id: <fl_aggie-2108981231370001@aggie.coaps.fsu.edu>

In article <35DB58C1.53FBD166@bctel.net>, Jeff Gao <jeff_gao@bctel.net> wrote:

+ Does anybody know that whether perl 5.004 is y2k compilant?

Perl itself doesn't do dates.

James


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

Date: Fri, 21 Aug 1998 12:32:43 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Is Perl5.004 Year 2000 compilant?
Message-Id: <fl_aggie-2108981232440001@aggie.coaps.fsu.edu>

In article <6rj10g$jpv$3@marina.cinenet.net>, cberry@cinenet.net (Craig
Berry) wrote:

+ best stop talking before...oh, wait, excuse me, there's someone knocking
+ at the door an

Too bad...we'll miss you, Craig...

James


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

Date: 21 Aug 1998 15:53:42 GMT
From: scott@softbase.com
Subject: Re: Locking files on Window 95 server
Message-Id: <35dd9806.0@news.new-era.net>

dturley@pobox.com wrote:

> flock is not implemented on Win95 because it is not a multi-user system,
> therefore there should be noone else trynig to access the file.

flock may not be supported, but this couldn't be the reason why.
Windows 95 can multitask, and consider the example of a web server
running two CGI programs at once. Locking of some sort would be needed.
I imagine flock is not supported because there is no underlying
operating system call that maps to it -- locking, if I remember
correctly, is done as part of the CreateFile system call. It would be
difficult to make this map to a Perl flock/open call.  In UNIX,
everything is done in small, bite-sized micro-steps, whereas in Win32,
which was heavily influenced by VMS, everything is done in bigger
macro-steps.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


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

Date: Fri, 21 Aug 1998 16:12:38 +0100
From: "Ronan Collins" <ronan.collins@heanet.ie>
Subject: logfile analysis
Message-Id: <6rk2h3$hkl$1@Nazard.heanet.ie>

I am an internet access provider and I am planning to identify, for each
site, the top N (where N is a pre-set integer) host recipients of data, and
the top N external sources of data.
Has anyone done this before?  If so, please advise me.

Cheers.




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

Date: 21 Aug 1998 15:54:07 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: logfile analysis
Message-Id: <6rk56v$ou6$7@news.iastate.edu>

Ronan Collins (ronan.collins@heanet.ie) wrote:
: I am an internet access provider and I am planning to identify, for each
: site, the top N (where N is a pre-set integer) host recipients of data, and
: the top N external sources of data.
: Has anyone done this before?  If so, please advise me.

This is not a perl question. You can use perl to solve your problem
but that's not enough to get your question answered in this
newsgroup.

You should look into commercial logfile analyzers (or pay someone
to do this for you) anyway, if you're asking here. It will be much
easier on you.

cheers,

Josh

-- 
Sir, I have found you an argument. I am not
obliged to find you an understanding.
     - Samuel Johnson



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

Date: 21 Aug 1998 15:34:24 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: LWP::Simple Question
Message-Id: <6rk420$ou6$3@news.iastate.edu>

Joseph June (jjune@midway.uchicago.edu) wrote:
: so $page has a value of 

: LOCUS       DMU31961   338234 bp    DNA             INV       28-DEC-1995
: DEFINITION  Drosophila melanogaster bithorax complex (BX-C), complete
: sequence.
: ACCESSION   U31961
: NID         g969077
: KEYWORDS    .
: SOURCE      fruit fly.

: <---snip>

: How can a parse the data so that I can have $DEFINITION = "Drosophila
: melanogaster... ", $ACCESSION = U31961... etc...??

: I can't seem to parse it because $page does not take in value line by
: line... but all at once when used with "get"

Your problem is really one of diddling a multiline string, not
one with LWP.

You might do this by doing something like

# Untested code
my @lines = split(/\n/, $page);
my $line = '';
my %data = ();
foreach $line (@lines) {
	chomp $line;
	$data{$1} = $2 if $line =~ /^(\w+)\s+(.*)/;
}

which could doubtless be improved upon, especially if you want
to do something more specific with lines like the first two
in your example.

This will result in a hash with keys "LOCUS", "DEFINITION", "ACCESSION",
etc., and the corresponding values "DMU31961...", "Drosophila...",
"U31961", etc.

Hope this gives you some ideas. The perlre manual page, as well
as the entry for split(), and the info about hashes in perldata,
should be illuminating.

Josh

-- 
Sir, I have found you an argument. I am not
obliged to find you an understanding.
     - Samuel Johnson



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

Date: Fri, 21 Aug 1998 07:50:03 -0700
From: Mooneer Salem <mooneer@earthlink.net>
Subject: Mistake (Was: Re: Help: Problem with Pattern-Matching)
Message-Id: <35DD891B.F908AAE@earthlink.net>

Mooneer Salem wrote:
> 
> 
> Try something like this:
> 
> $text = "Many greetings to Petra and Sebastian";
> $text =~ tr/A-z/a-z/;
> $text =~ s/\s*(.)(*)\s*/$1$2/g;
> $text =~ s/ //g;
> 
> Hope this helps.
> 

Oops! I meant the following:

$text = "Many greetings to Petra and Sebastian";
$text =~ tr/A-Z/a-z/;
$text =~ s/\s*(.)(.*)\s*/
        $1 =~ tr/a-z/A-Z/;
        $total = $1$2;
        $total;
        /ge;
$text =~ s/ //g;

Sorry for any trouble the original poster had with my code.
 
--
Mooneer Salem
Webmaster & Administrator for HyperNetMsg
(http://hypernetmsg.hypermart.net)


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

Date: Fri, 21 Aug 1998 11:05:34 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Mistake (Was: Re: Help: Problem with Pattern-Matching)
Message-Id: <35DD9ACE.654C3F4@gpu.srv.ualberta.ca>

Mooneer Salem wrote:
! 
! Mooneer Salem wrote:
! >
! >
! > Try something like this:
! >
! > $text = "Many greetings to Petra and Sebastian";
! > $text =~ tr/A-z/a-z/;
! > $text =~ s/\s*(.)(*)\s*/$1$2/g;
! > $text =~ s/ //g;
! >
! > Hope this helps.
! >
! 
! Oops! I meant the following:
! 
! $text = "Many greetings to Petra and Sebastian";
! $text =~ tr/A-Z/a-z/;
! $text =~ s/\s*(.)(.*)\s*/
!         $1 =~ tr/a-z/A-Z/;
!         $total = $1$2;
!         $total;
!         /ge;
! $text =~ s/ //g;
! 
! Sorry for any trouble the original poster had with my code.

Oops!

you didn't try that one either did you?
a) the pattern in the regex isn't matching what you
   think it is.
b) $1 is a read-only variable, you can't modify it
   with that tr///.
c) your delimiters on tr/// are problematic in the
   present context of s///
d) $total = $1$2; is also incorrect.
 ...
Please try to test your helpful suggestions before
posting them to the group.

regards
andrew


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

Date: Fri, 21 Aug 1998 16:02:45 +0100
From: Dean Darlison <dean_darlison@dial.pipex.com>
Subject: Re: Perl on linux
Message-Id: <35DD8C15.A128391D@dial.pipex.com>

Kevin Thorley wrote:

> Hi!  I've been writing perl scripts for awhile on Win95, but recently
> decided to install linux on my computer.  Now I can't even get a
> simple script to run!  Perl is located at /usr/bin/perl, but when I
> add this command as the first line of the script, it doesn't work :
> #!/usr/bin/perl.  The error message says something like program not
> found. When I run the following from the command line though, it works
> great:
>
>         /usr/bin/perl perltest.pl
>
> Whats going on here?  i didn't install perl myself, it came with the
> RedHat 5.1 installation.  Any ideas?
>
>         Kevin Thorley
>         kthor@idt.net
>

the script needs to be marked as executable:

chmod +x <scriptname>

the script can then be exec'd and perl (#!/usr/bin/perl) loaded to
interpret it.

Cheers,
    Dean.




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

Date: 21 Aug 1998 10:28:08 -0500
From: yoyo@huitzilo.tezcat.com (YoYo)
Subject: Re: Perl on linux
Message-Id: <6rk3m8$dhj@huitzilo.tezcat.com>

Kevin Thorley <kthor@mail.idt.net> wrote:

>Hi!  I've been writing perl scripts for awhile on Win95, but recently
>decided to install linux on my computer.  Now I can't even get a
>simple script to run!  Perl is located at /usr/bin/perl, but when I
>add this command as the first line of the script, it doesn't work :
>#!/usr/bin/perl.  The error message says something like program not
>found. When I run the following from the command line though, it works
>great: 
>
>	/usr/bin/perl perltest.pl
>
>Whats going on here?  i didn't install perl myself, it came with the
>RedHat 5.1 installation.  Any ideas?

Try doing ./perltest.pl. The current directory isn't in the search path in
RedHat5.1.


-- 
----YoYo----------------yoyo@tezcat.com------------and stuff------
  "Consider this rule of thumb: To the extent that philosophical 
 positions both confuse and close doors to further inquiry, they 
 are likely to be wrong."     -Edward O. Wilson


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

Date: Fri, 21 Aug 1998 16:01:10 +0100
From: Lee Benfield <lbenfie1@s_p_a_m.ford.com>
Subject: Re: Perl on linux
Message-Id: <35DD8BB6.20E1@s_p_a_m.ford.com>

Kevin Thorley wrote:
> 
> Hi!  I've been writing perl scripts for awhile on Win95, but recently
> decided to install linux on my computer.  

WELCOME!! :)  You made the right choice! *grin*

> Now I can't even get a
> simple script to run!  Perl is located at /usr/bin/perl, but when I
> add this command as the first line of the script, it doesn't work :
> #!/usr/bin/perl.  The error message says something like program not
> found.

Have you checked:

 ./ is in the path
  (type set to see the environment)
your program is executable.
  (use chmod a+x perltest.pl)

(I don't think it's the second one, as it would give a more informative
error, but just in case *grin*)

I guess it's probably cos ./ isn't in the path.

Try using ./perltest.pl to run it.

Cheers!

Lee.

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Lee A Benfield, Ford Motor Co. | The above are my opinions alone.
                               | I couldn't afford better ones...


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

Date: Fri, 21 Aug 1998 18:21:31 GMT
From: techsoft@abcpages.com (Alex Kovalenko)
Subject: Question: How to <BR>
Message-Id: <35ddb9e6.6140945@news.sprint.ca>

Hi there,

I was just wondering, I have this comment using textarea, and is there
any idea how I can check if the user press enter (break the line) and
use <br> or <p> instead of #13 (or whatever it is in UNIX)?

Thanks in advance.


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

Date: 21 Aug 1998 15:44:47 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Reading from files
Message-Id: <6rk4lf$ou6$4@news.iastate.edu>

I.J. Garlick (ijg@csc.liv.ac.uk) wrote:
: Ok Ok. I never put a die there, I know I should but I never do. This was
: supposed to only give the relevant bit, I wasn't going to the trouble of
: writing a complete script.

: FYI I always run with -w and 'use strict' but i figure if others don't
: want to I won't get pedantic about it, after all it's there funeral.

Strangely enough, a quick

close(FH) or die "close failed: $!\n";

would have been less work (typing) than your comment. :)


Josh

-- 
Sir, I have found you an argument. I am not
obliged to find you an understanding.
     - Samuel Johnson



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

Date: Fri, 21 Aug 1998 15:09:14 GMT
From: patrick@cre8tivegroup.com
Subject: Re: regex question: striphtml and misformed tags
Message-Id: <6rk2iq$i1t$1@nnrp1.dejanews.com>

In article <6rinhm$10a$1@client3.news.psi.net>,
  abigail@fnx.com wrote:
> ++ More importantly, why does the bad tag cause a runaway process?  Shouldn't
> ++ it just die?
>
> No. It's just that Perl tries deparately to satisfy the regex. And the
> regex doesn't give Perl hints on failures. The culprits are the
> ".*?" and '.*?' parts. ".*?" does *not* mean "match a double until
> the next double quote". It means "match a double quote, then arbitrary
> text, then a double quote, and minimize the length of the text such that
> the *ENTIRE REGEX STILL SUCCEEDS*".
>
> So, in your case, after the RE machines hobbles to the " after the
> WIDTH=150, it will first use the next " to pair, then continue. 10 matches
> the [^>'"] *, then it gets another ". This will be first paired with
> the next ", etc. Eventually, you run out of "'s when hitting the end
> of the string, and the regex still hasn't matched. So, the RE machine
> backs up, and it will pair the third " from the end with the last one.
> That fails. So, it backs up another ", matching it with the next, etc.
> This is basically exponential in the number of "'s. If you try to apply
> the above regex to a normal HTML file, and there's a mistake like yours
> not far from the end, it'll take eons before Perl decides the regex
> doesn't match.
>
> The regex is far better written as:
>
> s{<                    # opening angle bracket
>    (?:                 # Non-backreffing grouping paren
>         [^>'"] +       # 1 or more things that are neither > nor ' nor ";
>                        # this keeps -w happy.
>            |           #    or else
>         "[^"]*"        # a section between double quotes
>            |           #    or else
>         '[^']*'        # a section between single quotes
>    ) *                 # repetire ad libitum. (* so we match <>)
>   >                    # closing angle bracket
> }{}gsx;                # mutate into nada, nothing, and niente
>
> Abigail

Unfortunately, this code does not fare any better with the above string in the
middle of a long html file.  It suffers the same problems as Tom's code, by
searching forever for the match, or lack thereof.

To fix it, I removed the double quote from [^>'"].  It's certainly not a fix,
since it forces the regex to basically delete everything in <>, no matter what
(Or so it seems to me!).

Thanks for the help, though!  I'm glad to get help so quickly...  :)

Patrick

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: 21 Aug 1998 16:39:10 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: regex question: striphtml and misformed tags
Message-Id: <6rk7re$d9s$1@client3.news.psi.net>

patrick@cre8tivegroup.com (patrick@cre8tivegroup.com) wrote on MDCCCXVI
September MCMXCIII in <URL: news:6rk2iq$i1t$1@nnrp1.dejanews.com>:
++ In article <6rinhm$10a$1@client3.news.psi.net>,
++   abigail@fnx.com wrote:
++ >
++ > s{<                    # opening angle bracket
++ >    (?:                 # Non-backreffing grouping paren
++ >         [^>'"] +       # 1 or more things that are neither > nor ' nor ";
++ >                        # this keeps -w happy.
++ >            |           #    or else
++ >         "[^"]*"        # a section between double quotes
++ >            |           #    or else
++ >         '[^']*'        # a section between single quotes
++ >    ) *                 # repetire ad libitum. (* so we match <>)
++ >   >                    # closing angle bracket
++ > }{}gsx;                # mutate into nada, nothing, and niente
++ >
++ 
++ Unfortunately, this code does not fare any better with the above string in th
++ middle of a long html file.  It suffers the same problems as Tom's code, by
++ searching forever for the match, or lack thereof.

Yes, I later realized that there's another problem. If there's no match,
the RE machine will match (?:['>"]*)+ in all possible ways. And that's a
whole lot.

Too bad there isn't an operator that says: be as greedy as you can, and
*never* give back what you once took.

++ To fix it, I removed the double quote from [^>'"].  It's certainly not a fix,
++ since it forces the regex to basically delete everything in <>, no matter wha
++ (Or so it seems to me!).

Better is to forget about striphtml, and use HTML::Parser. 



Abigail
-- 
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
!$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'


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

Date: 21 Aug 1998 15:47:29 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Search of Large files
Message-Id: <6rk4qh$ou6$5@news.iastate.edu>

Alvin Chao (chaoaj@jmu.edu) wrote:
: I'm looking for information on algorithms/methods in PERL for
: searching a extracting a record from a HUGE(75MB) flat file.  
: If anyone knows of any processor efficient and stable search algos for
: big files please point me in the right direction.  Any general tips
: for searching would also be appreciated.

See any data structures / algorithms textbook. This isn't a perl
question.



Josh

-- 
Sir, I have found you an argument. I am not
obliged to find you an understanding.
     - Samuel Johnson



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

Date: 21 Aug 1998 15:50:25 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Send cmd and Receive result from command?
Message-Id: <6rk501$ou6$6@news.iastate.edu>

8\(F&@ (versace@gianni.com) wrote:
: Hi all,

: How to do that? I'd tried 

: open (CMD, "|$CMD|");

: but received nothing using
: open (CMD, "|$CMD|");
: sleep (5);
: while (<CMD>) {
: 	print $_;
: }

: I can receive the result if the first '|' in "|$CMD|" was removed.

: Please help!

Try

my $result = `$command`;

and read in the perl manpages on backticks. (My example will
not work as you expect if, for instance, the command returns
more than one line.)

The documentation for system() may also prove enlightening.

Josh

-- 
Sir, I have found you an argument. I am not
obliged to find you an understanding.
     - Samuel Johnson



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

Date: Fri, 21 Aug 1998 15:57:04 GMT
From: Daniel Grisinger <dgris@rand.dimensional.com>
Subject: Re: swap words in regexp
Message-Id: <6rk5c6$3th@flatland.dimensional.com>

[posted to comp.lang.perl.misc but not mailed to the cited
 author due to a broken mail header]

In article <35DD87D5.41C6@mashie.ece.jhu.edu>,
Chenyang Xu  <NOSPAMchenyangNOSPAM@mashie.ece.jhu.edu> wrote:
>   I would like to perform the following swap in PERL using regexp.
>
>     UpperCaseWord -> CaseUpperWord
>     AnotherUpperCaseWord -> UpperAnotherCaseWord

$string = 'UpperCaseWord';
$string =~ s/\b([A-Z][a-z]+?)([A-Z][a-z]+?)/$2$1/;

>   Please reply me by email. Thanks.

Please don't break your reply-to address if you'd like to receive
e-mail responses.

dgris


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

Date: Fri, 21 Aug 1998 16:00:40 GMT
From: huntersean@hotmail.com
Subject: Re: system commands
Message-Id: <6rk5j7$mke$1@nnrp1.dejanews.com>

In article <35dd6ecc.15840367@news.nottingham.ac.uk>,
  itxjcs@unix.ccc.nottingham.ac.uk (James Stout) wrote:
> Hi
>
> I can't find the answer in my books or in the FAQ's.
> On my system you have to type setup opeiningres2.0 before you can use
> the db. I can't get the following script to work though. I get a
> message saying that setuo couldn't be found.
>
> Any ideas?
>
> Thanks in advance
>
> James Stout
>
> #!/usr/local/bin/perl -w
>
> system "setup openingres2.0";
>
> exit;
>
Assuming unix, have you tried

#!/usr/local/bin/perl -w

system "csh", "-e, "which setup";

exit;

Basically,  you probably need an absolute pathname to "setup" to call it from
perl.  Find it and put the whole path into your script.

Sean H

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum


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

Date: Fri, 21 Aug 1998 16:53:08 +0100
From: "Jeremy Goldberg" <jgoldberg@dial_put-a-decimal-here_pipex.com>
Subject: Testing for socket disconnection
Message-Id: <6rk550$blv$1@plug.news.pipex.net>

Someone must know the answer to this one -

If you have a perl script running from inetd, with a socket for STDIN and
STDOUT, how can you check whether or not the connection has been broken?
eof( STDIN ) isn't the answer, as it tends to block.

Any ideas?

- Jeremy Goldberg (fix the address to reply by email).




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

Date: 21 Aug 1998 15:44:33 GMT
From: guckes@math.fu-berlin.de (Sven Guckes)
Subject: Re: vim - printing on DOS/Windows
Message-Id: <slrn6tr5f0.rt4.guckes@stott.math.fu-berlin.de>

oulqr@pbaarpgh.arg (Blake Hyde):
> >Remember, we're talking about Windows. There is no lpr.
> No, but there is a prn.  In vim, for instance, you can
> print the text of the current file by doing this:
> :w
> :!type filename.txt > prn

And if you do not want to save the current text but just print it then you do:

	:w !lpr

Or if you want to print just part of the text from line '3' to '12':

	:3,12w !lpr

Or print from the current line unto the end of the buffer:

	:,$w !lpr

Yes, this works fine on Unix - maybe it'll work
with "prn" on DOS/Windows?  Feedback, please!

Sven  [who should write a HowTo on this, too]


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

Date: Fri, 21 Aug 1998 09:28:55 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
Subject: Re: what is 'sub f () {555};' Thanks!
Message-Id: <35DDA047.F312BB58@cks.ssd.k12.wa.us>

Andrew M. Langmead wrote:
> 
> kortbein@iastate.edu (Josh Kortbein) writes:
> 
> >: sub f () {555};
> 
> >It looks to me like it returns 555, regardless of the argument
> >provided

Despite the RTFM flames, CGI off topic posts and other assorted noise
here, I must say that this is EXACTLY why I read this newsgroup.  Today,
this thread taught me a new trick, and I will be using in my code soon.

The example provided earlier with umask was great.

Thanks to all for my edification.

Jerome "New Dog, Old Trick" O'Neil


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

Date: 21 Aug 1998 15:03:30 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: what is 'sub f () {555};'
Message-Id: <6rk282$ou6$1@news.iastate.edu>

Abigail (abigail@fnx.com) wrote:
: Josh Kortbein (kortbein@iastate.edu) wrote on MDCCCXV September MCMXCIII
: in <URL: news:6rhvkr$bvv$6@news.iastate.edu>:
: ++ Steven Smith (steves@wco.com) wrote:
: ++ : I'm trying to understand a lib we pulled off of the net.  I've never
: ++ : seen this before.
: ++ : what would a sub declaration like this do??
: ++ 
: ++ : sub f () {555};
: ++ 
: ++ Have you tried it?
: ++ 
: ++ It looks to me like it returns 555, regardless of the argument
: ++ provided - which leads me to believe that it's either (a) useless,
: ++ or (b) capable of doing something else that I don't see. AFAIK,
: ++ though, it just returns 555.
: I guess you find
: # define f 555
: in C code useless as well?

No, but since I don't need to use C I prefer

const int f = 555;

in C++.

Despite the fact that constant subs have a use, I still don't
find them very useful - it's better IMO for code to just use
plain old scalars, as opposed to something that borders on
obfuscation.


Josh

-- 
"A computer lets you make more mistakes faster than any invention
in human history with the possible exceptions of handguns and tequila."
       - Mitch Ratliffe, _Technology Review_ April, 1992



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

Date: 21 Aug 1998 15:06:54 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: what is 'sub f () {555};'
Message-Id: <6rk2ee$ou6$2@news.iastate.edu>

Andrew M. Langmead (aml@world.std.com) wrote:
: kortbein@iastate.edu (Josh Kortbein) writes:

: >: sub f () {555};

: >It looks to me like it returns 555, regardless of the argument
: >provided 

: Close, it refuses to take any arguments, and returns 555. (The parens
: between the subroutine name and the block contain the subroutines
: prototype. A null prototype prevents the functions from getting
: arguments)

: You know one the neat things about perl is that it is so wasy to try
: things out.


: /usr/tmp>perl -e 'sub f () { 555 } printf f(2)'
: perl -e 'sub f () { 555 } printf f(2)'
: Too many arguments for main::f at -e line 1, at end of line
: Execution of -e aborted due to compilation errors.
: /usr/tmp>

I suppose that's what I get for not trying it myself, but what
I intended to mean was more along the lines of "either try it,
or look at it and try to figure out what it does before you
ask on the newsgroup" - I then did the latter.



Josh

-- 
"A computer lets you make more mistakes faster than any invention
in human history with the possible exceptions of handguns and tequila."
       - Mitch Ratliffe, _Technology Review_ April, 1992



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

Date: 21 Aug 1998 16:43:01 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: what is 'sub f () {555};'
Message-Id: <6rk82l$d9s$2@client3.news.psi.net>

Andrew M. Langmead (aml@world.std.com) wrote on MDCCCXVI September
MCMXCIII in <URL: news:Ey1MA4.9p4@world.std.com>:
++ 
++ >: sub f () {555};
++ 
++ Close, it refuses to take any arguments, and returns 555. (The parens
++ between the subroutine name and the block contain the subroutines
++ prototype. A null prototype prevents the functions from getting
++ arguments)
++ 
++ /usr/tmp>perl -e 'sub f () { 555 } printf f(2)'
++ perl -e 'sub f () { 555 } printf f(2)'
++ Too many arguments for main::f at -e line 1, at end of line
++ Execution of -e aborted due to compilation errors.
++ /usr/tmp>


Not so fast! :)

$ perl -we 'sub f () {555} print &f(2), "\n"'
555
$


The () prototype will prevent you from calling f with arguments, but
only when you're not using &.



Abigail
-- 
perl -weprint\<\<EOT\; -eJust -eanother -ePerl -eHacker -eEOT


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

Date: 12 Jul 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 Mar 98)
Message-Id: <null>


Administrivia:

Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.

If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu. 


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

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