[9902] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3495 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Aug 20 19:07:16 1998

Date: Thu, 20 Aug 98 16:00:22 -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           Thu, 20 Aug 1998     Volume: 8 Number: 3495

Today's topics:
    Re: 2 quick questions (Josh Kortbein)
    Re: [Q] deprecated use of split (what? why?) <metcher@spider.herston.uq.edu.au>
        Can I use postgresql of redhat5.1 with perl ? PLease he <ccadic@cadic.com>
    Re: Can I use postgresql of redhat5.1 with perl ? PLeas (Alastair)
    Re: COBOL and Perl (Shaun C. Murray)
    Re: Code Style (Was: How to sort this associative array (Josh Kortbein)
        Delay in bidirectional communication between Perl and C <Richmont.Sy@exchange.sms.siemens.com>
        Delay in bidirectional communication between Perl and C <Richmont.Sy@exchange.sms.siemens.com>
    Re: Dumb Windows Question <dewitt@jlab.org>
    Re: Easy regx please help.... (Kevin R Falcone)
    Re: Easy regx please help.... (Abigail)
    Re: HELP! Weird numeric errors (Abigail)
    Re: Installation problems with Perl5.004 (Gary L. Burnore)
    Re: Last_modified (help with configureing date output) <support@pasdespam.penlink.com>
        Looking for documentation about DBI/DBD for mysql <louis.banens@tip.nl>
    Re: Looking for documentation about DBI/DBD for mysql (Matt Knecht)
    Re: Looking for Perl FAQ Bot (Josh Kortbein)
    Re: Nested regexp <conmara@tcon.net>
        NT: Need to be able to get/set security descriptor owne (John L. Allen)
        Perl search for directory structure jffitzge766@my-dejanews.com
    Re: Perl Style <zenin@bawdycaste.org>
    Re: Reading from file (Matt Knecht)
    Re: regex question: striphtml and misformed tags (Honza Pazdziora)
    Re: Returning an image from a call to a script (Josh Kortbein)
    Re: Screen Scrubbing & Terminal Scripting <keshlam@us.ibm.com>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 20 Aug 1998 22:30:25 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: 2 quick questions
Message-Id: <6ri821$rkn$4@news.iastate.edu>

Kris Davey (mivl@inquo.net) wrote:
: 1. I think I remeber seeing something a while back about compiling perl
: scripts to an exe. I can't remeber if was a p3exe.bat or an actual compiler.
: I would like to create scripts that I can run on workstations that don't
: have Perl. (These workstations are on an isolated network with no ISAPI web
: server).

Why don't you just install perl on those machines, then? Web servers
are not required to run perl.

The new release of perl does compile to binary, and for once it
may actually do what you want (the stock answer is "yes, but it
probably doesn't do {speed up my CGIs, etc.}"). I hear it's
still not as hot as one would hope, though.

: 2. What would be the best way, if any to create a script that connects from
: the server to the workstation and runs code on the workstation. i.e. copies
: new executables down, kills processes, run uninstall, reruns install,
: restarts processes. I was looking at sockets but i'm not sure that would
: work maybe it's a module that I overlooked. This is between an NT Server and
: NT Workstations.

Isn't NT Server supposed to let you administrate networks, or something?
Sounds like you'd be better served poking around in that direction, rather
than writing your own.

Other (bad) ways include: writing client/server code in which the
client is run on the NT server, and contacts the servers running on
the NT workstations (confusing, eh?), and feeds those servers jobs to run.
Or, install web servers and perl on the workstations, and do the same
thing by hitting CGIs on the workstations. Both ways suck.


Josh

-- 
         "Writing is like prostitution.
          First you do for the love of it,
          Then you do it for a few friends,
          And finally you do it for money."
                 -Moliere



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

Date: Fri, 21 Aug 1998 08:51:12 +1000
From: Jaime Metcher <metcher@spider.herston.uq.edu.au>
Subject: Re: [Q] deprecated use of split (what? why?)
Message-Id: <35DCA860.3D410B1C@spider.herston.uq.edu.au>

Jonathan Feinberg wrote:
> 
> 
>    $lines = (@dummy = split("\n", $s));
> 

Or:

     $lines = @{[split("\n", $s)]};

which is kind of what Abigail is saying perl should be doing.

-- 
Jaime Metcher


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

Date: Thu, 20 Aug 1998 23:02:41 +0200
From: "cadic" <ccadic@cadic.com>
Subject: Can I use postgresql of redhat5.1 with perl ? PLease help
Message-Id: <6ri2j8$f2j$1@platane.wanadoo.fr>

I instaleld redhat 5.1 with postgresql.
I'm looking for a good place to find a PERL interface.

I found a lot of perl interface but none is working (most of them are for
postgresql95...)

Does any one know a freeware interface to use SQL databases with postgresql
with the PERL5 language.

Help

PLease reply to ccadic@cadic.com

Thanks so much






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

Date: Thu, 20 Aug 1998 22:56:35 GMT
From: alastair@calliope.demon.co.uk (Alastair)
Subject: Re: Can I use postgresql of redhat5.1 with perl ? PLease help
Message-Id: <slrn6tpe2t.53.alastair@calliope.demon.co.uk>

cadic <ccadic@cadic.com> wrote:
>I instaleld redhat 5.1 with postgresql.
>I'm looking for a good place to find a PERL interface.
>
>I found a lot of perl interface but none is working (most of them are for
>postgresql95...)
>
>Does any one know a freeware interface to use SQL databases with postgresql
>with the PERL5 language.

There are lots of docs that come with the DB. I suggest to look at them and find
out where to go to find answers. Their web site is probably a good place to
start. I bet it's mentioned in the docs.

-- 

Alastair
work  : alastair@psoft.co.uk
home  : alastair@calliope.demon.co.uk


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

Date: 20 Aug 1998 22:43:37 GMT
From: scm@enterprise.net (Shaun C. Murray)
Subject: Re: COBOL and Perl
Message-Id: <6ri8qp$ohh$4@news.enterprise.net>

In article <35DB2455.1579@min.net>, John Porter says...
>
>DavidM wrote:
>> 
>> IBM will very soon allow COBOL to do everything that JAVA can.
>
>It's "Java", for the capslock-impaired out there.

Better tell Sun. It's JAVA on the front of my 'just JAVA' book though that was 
the JDK 1.0 edition. Maybe they added lower case later. ;-)

Shaun



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

Date: 20 Aug 1998 22:16:02 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Code Style (Was: How to sort this associative array?)
Message-Id: <6ri772$rkn$2@news.iastate.edu>

Matt Knecht (hex@voicenet.com) wrote:
: You've touched on a petty little problem I've been trying to solve.
: That is, how to format such a beast as above.  I realize you just typed
: that monstrosity on the fly, so you shouldn't be held too accountable
: for its readability, but how would you format that in real code?
: Unfortunately perlstyle.pod doesn't mention this (Although, I don't quite
: agree with everything in there anyway).

[snip]

: Which also sucks.  Opinions on how to format these constructs, anyone?

I try to use braces as in if and while blocks, and place array
arguments or map/sort right next to the nearest appropriate brace:

@foo = map {
		$_->[0];
	} sort {
		$a->[1] <=> $b->[1];
	} map {
		[$_, -s $_];
	} @foo;

Then again, sometimes I find that horrendous. If the map/sort blocks
are logically one-liners, then I sometimes do as you did, like

@foo = map { }
sort {}
map {} @foo;

Picky people may wish to align both funcs and braces along with that.

cheers,

Josh

-- 
         "Writing is like prostitution.
          First you do for the love of it,
          Then you do it for a few friends,
          And finally you do it for money."
                 -Moliere



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

Date: Thu, 20 Aug 1998 16:45:40 -0400
From: Rich Sy <Richmont.Sy@exchange.sms.siemens.com>
Subject: Delay in bidirectional communication between Perl and C
Message-Id: <35DC8AF4.5AAF@exchange.sms.siemens.com>

I'm using IPC::Open2 to create bidirectional communication facility
between perl and C program.  I've created a simple simulation with perl
sending strings to the C program which in turn is echoed back.  I
noticed that there's something wrong with the response received from the
C program.

Below are the programs and the result.  Any ideas appreciated:

PERL PROGRAM
#!/usr/bin/perl
use FileHandle;
use IPC::Open2;
print("STARTING PROGRAM");
STDOUT->autoflush(1);
&f_print("\nCreating bidirectional channel");
#$childpid = open2( \*DBREAD, \*DBWRITE, './myc') or die 'Unable to
open2 -';
$childpid = open2( \*DBREAD, \*DBWRITE, './myc2') or die 'Unable to
open2 -';
DBWRITE->autoflush(1);
DBREAD->autoflush(1);
while(1) {
        print "\nPlease enter a string: ";
        $line = <STDIN>;
        break if $line -~ m/quit/i;
        print "\nWriting to DBWRITE";
        print DBWRITE $line,"\n" or die "unable to write to Dbwrite -";
        sleep 1;
        print "\nReading from DBWRITE";
        while( $line = <DBREAD> ) {
                print "\nRead line is:\n";
                print $line,"\n";
                last if $line =~ /END/;
        }
}

exit 0;


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

Date: Thu, 20 Aug 1998 16:53:27 -0400
From: Rich Sy <Richmont.Sy@exchange.sms.siemens.com>
Subject: Delay in bidirectional communication between Perl and C
Message-Id: <35DC8CC7.58B3@exchange.sms.siemens.com>

I accidentally sent the first posting.  Here's the rest of the message:

I'm using IPC::Open2 to create bidirectional communication facility
between perl and C program.  I've created a simple simulation with perl
sending strings to the C program which in turn is echoed back.  I
noticed that there's something wrong with the response received from the
C program.

Below are the programs and the result.  Any ideas appreciated:

##### PERL PROGRAM ######
#!/usr/bin/perl
use FileHandle;
use IPC::Open2;
print("STARTING PROGRAM");
STDOUT->autoflush(1);
print("\nCreating bidirectional channel");
$childpid = open2( \*DBREAD, \*DBWRITE, './myc2') or die 'Unable to
open2 -';
DBWRITE->autoflush(1);
DBREAD->autoflush(1);
while(1) {
        print "\nPlease enter a string: ";
        $line = <STDIN>;
        break if $line -~ m/quit/i;
        print "\nWriting to DBWRITE";
        print DBWRITE $line,"\n" or die "unable to write to Dbwrite -";
        sleep 1;
        print "\nReading from DBWRITE";
        while( $line = <DBREAD> ) {
                print "\nRead line is:\n";
                print $line,"\n";
                last if $line =~ /END/;
        }
}
exit 0;

/****** C PROGRAM myc2.c ******/
#include <stdio.h>
#define STRINGLEN 200
char string[STRINGLEN+1];

main()
{
        setbuf(stdout,NULL);
        fprintf(stdout, TEMPFILE);
        while( fgets(string,STRINGLEN,stdin) != NULL ) {
                fprintf(stdout, "%s\nEND\n", string);
                fflush(NULL);
        }
}

######## OUTPUT ############
STARTING PROGRAM
Creating bidirectional channel
Please enter a string: hello there
Writing to DBWRITE
Reading from DBWRITE
Read line is:
hello there
Read line is:
		<< \n from C program
Read line is:
END

Please enter a string: how are you?
Writing to DBWRITE
Reading from DBWRITE
Read line is:
		<< why blank?
Read line is:

Read line is:
END

Please enter a string: where do you live?
Writing to DBWRITE
Reading from DBWRITE
Read line is:
how are you?	<< why delayed?
Read line is:

Read line is:
END

Please enter a string: that's all folks.
Writing to DBWRITE
Reading from DBWRITE
Read line is:
		<< again blank?
Read line is:

Read line is:
END


Please enter a string: bye
Writing to DBWRITE
Reading from DBWRITE
Read line is:
where do you live?	<< again delayed?
Read line is:

Read line is:
END


Thanks, Rich :)
Richmont.Sy@exchange.sms.siemens.com


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

Date: Thu, 20 Aug 1998 18:02:00 -0400
From: Shane Dewitt <dewitt@jlab.org>
Subject: Re: Dumb Windows Question
Message-Id: <35DC9CD8.7887@jlab.org>

Ken McNamara wrote:
> 
> Robert -
> 
> My choice would be to open a DOS window and run the program.  There's
> probably methods for opening windows and outputing to them - but no sense
why not just right click on the perl script and uncheck close on exit?


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

Date: 20 Aug 1998 21:17:35 GMT
From: kevinfal@blue.seas.upenn.edu (Kevin R Falcone)
Subject: Re: Easy regx please help....
Message-Id: <6ri3pf$jgs$1@netnews.upenn.edu>

chad@gurucom.net wrote:
: I know this is essy, but i keep screwing it up could someone please give me
: the regx to parse this line.  thanks.


: $line = '<a href="http://i.am.stupid.com/index.html">Yes that's me</a>';

: this is what I want:

: ($link, $title) = ( $line =~ /(?)(?)/; }

: -thanks chad
This will work in the specific case, but you may wish to refine it for the
general case (ie, make sure there is only one set of quotes)

($link, $title) = ($line =~ /<.*?\"(.*?)\">(.*?)<\/a>/);


--------------------------------------------------------------------------------Kevin Falcone

I refuse to have a battle of wits with an unarmed person.
--------------------------------------------------------------------------------


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

Date: 20 Aug 1998 21:39:51 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Easy regx please help....
Message-Id: <6ri537$r12$2@client3.news.psi.net>

chad@gurucom.net (chad@gurucom.net) wrote on MDCCCXV September MCMXCIII
in <URL: news:6rhvci$1vb$1@nnrp1.dejanews.com>:
++ I know this is essy, but i keep screwing it up could someone please give me
++ the regx to parse this line.  thanks.
++ 
++ 
++ $line = '<a href="http://i.am.stupid.com/index.html">Yes that's me</a>';
++ 
++ this is what I want:
++ 
++ ($link, $title) = ( $line =~ /(?)(?)/; }


Well, the easiest way is:

   ($link, $title) = ("http://i.am.stupid.com/index.html", 
                      "Yes that's me");

But if you really want to parse HTML, get the appropriate module
from CPAN.



Abigail
-- 
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'


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

Date: 20 Aug 1998 21:41:18 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: HELP! Weird numeric errors
Message-Id: <6ri55u$r12$3@client3.news.psi.net>

Harry McGreggor (harry@dublin.net) wrote on MDCCCXV September MCMXCIII in
<URL: news:35dcb17e.73589470@news.netcom.ca>:
++ Hi,
++ 
++ Could someone please give me a few pointers to why this doesn't work?
++ 

Read the manual about printf, and what its return value is.
You might want to use another function with a simular name,
but with a different return value and side effect.



Abigail
-- 
perl5.004 -wMMath::BigInt -e'$^V=new Math::BigInt+qq;$^F$^W783$[$%9889$^F47$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W98$^F76777$=56;;$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V%$^U;$^V/=$^U}while$^V!=$^W'


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

Date: Thu, 20 Aug 1998 21:31:43 GMT
From: gburnore@databasix.com (Gary L. Burnore)
Subject: Re: Installation problems with Perl5.004
Message-Id: <35ea959d.69338272@nntpd.databasix.com>

On Thu, 20 Aug 1998 18:32:59 GMT, in article
<6rhq4r$qci$1@nnrp1.dejanews.com>, news@alameh.net wrote:

>I am having the same error, I am crying daily because of this, because I am
>not able to run perl, can any body help to stop me from crying, my blood
>gloucose is high because of this problem, well my operating system is Digital
>Unix running on DEC ALPHA, version is 4.0d. the version of perl I am trying
>to install is the stable perl5.004 Please I am dying for a solution,
>
>thanks a lot, I know that there is very good, and great people over here to
>help in this
>Regards
>Issam
>
>

I had similar problems with 5.004 and went to 5.005 with no problems at all.
Perhaps that'd be your best solution as well.
-- 
      I DO NOT WISH TO RECEIVE EMAIL IN REGARD TO USENET POSTS
---------------------------------------------------------------------------
                  How you look depends on where you go.
---------------------------------------------------------------------------
Gary L. Burnore                       |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
DOH!                                  |  ][3:]3^3:]33][:]3^3:]3]3^3:]3]][3
                                      |  ][3 3 4 1 4 2  ]3^3 6 9 0 6 9 ][3
Special Sig for perl groups.          |     Official Proof of Purchase
===========================================================================


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

Date: Thu, 20 Aug 1998 16:01:41 -0500
From: Dane Miller <support@pasdespam.penlink.com>
Subject: Re: Last_modified (help with configureing date output)
Message-Id: <35DC8EB5.C6D8A40A@pasdespam.penlink.com>

Try using a stat() and localtime() together.  Maybe something like this:

open(FH, "my_file")
$atime = (stat FH)[9];   #the time last accessed
close (FH);
@formatted_time = localtime($atime);

See the "localtime" entry in the "perlfunc" manpage for the elements returned by
this function.  Also, note that in scalar context you get a formatted date/time
(like Wed Aug 19 14:22:21 1998).
$formatted_time = localtime($atime);   #scalar context

Hope this helps,
Dane

Jeff Litwiller wrote:

> The first one outputs Wednesday, August 19 1998 02:16 PM and the second one
> outputs Wed Aug 19 18:53:58 1998. I just like to control what part of the date
> I want displayed and how. Abreviated or written out. Now I understand that
> #config and #echo are webserver process and they have nothing to do with Perl,
> but I use them as SSI call to get what I want. I would just like include this
> option in one of my scripts. but If I do not want the time and just the date
> output for files last modification, is there a way?
>
> Is there a way to find out when the file was last viewed? So I could say my
> last visitor was here 10 minutes ago? like atime but I am not sure how to use
> it. Yes I am fairly new at this but am glad for any help in learning.
>
> Jeff Litwiller
>





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

Date: Thu, 20 Aug 1998 23:00:28 +0200
From: "Louis Banens" <louis.banens@tip.nl>
Subject: Looking for documentation about DBI/DBD for mysql
Message-Id: <6ri2np$6sq$1@news.worldonline.nl>

Hi,

Can anybody point me to some documentation about DBI/DBD for mysql.

Regards,

Louis Banens




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

Date: Thu, 20 Aug 1998 21:23:22 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Looking for documentation about DBI/DBD for mysql
Message-Id: <et0D1.218$b16.1442642@news3.voicenet.com>

Louis Banens <louis.banens@tip.nl> wrote:
>Can anybody point me to some documentation about DBI/DBD for mysql.

I think they may hide some information about it at www.mysql.org.

-- 
Matt Knecht - <hex@voicenet.com>


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

Date: 20 Aug 1998 22:09:46 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Looking for Perl FAQ Bot
Message-Id: <6ri6ra$rkn$1@news.iastate.edu>

Harry McGreggor (harry@dublin.net) wrote:
: Hi!

: I'm looking for a Perl FAQ Bot which spits out entrys in a given FAQ
: according to the users input. Do any such programs exist?

: Cheers,

Did you look on the web? It's far more useful than usenet for finding
such things.

If you mean, a "bot" that answers questions from the perl faq, then this
ugly little turd might get you started; you'd probably end up coupling
it with some CGI code.

#!/usr/local/bin/perl -w
use strict;

my $target = shift;
my $opt = shift;
if (defined($opt)) {
	@ARGV = </usr/local/lib/perl5/pod/perlfaq*.pod>;
} else {
	@ARGV = </usr/local/lib/perl5/pod/*.pod>;
}

while (<>) {
	print substr(substr($ARGV, rindex($ARGV, '/') + 1), 0, -4), ": $_" if /$target/;
}

If it's some arbitrary list of faqs you wish to serve, then the same
principle applies, but with other faq files.

If you want something completely different then maybe you're not
being specific enough in posing your question (because I don't get
it).


Josh

-- 
         "Writing is like prostitution.
          First you do for the love of it,
          Then you do it for a few friends,
          And finally you do it for money."
                 -Moliere



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

Date: Fri, 21 Aug 1998 00:25:04 GMT
From: Ken McNamara <conmara@tcon.net>
Subject: Re: Nested regexp
Message-Id: <35DCA240.FC237C92@tcon.net>

For anyone struggling with Regexp - check out "Mastering Regular Expressions"
from O'Reilly by Friedl.





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

Date: 20 Aug 1998 17:39:28 -0400
From: allen@gateway.grumman.com (John L. Allen)
Subject: NT: Need to be able to get/set security descriptor owner/group
Message-Id: <6ri52g$mlr@gateway.grumman.com>

I'm using Perl on NT 4.0 (Sarathy's perl5.00402-bindist04-bc w/ libwin32-0.12)

In the most obvious place, Win32::FileSecurity, there is nothing to allow
you to do the NT-equivalent of chown, via, I would presume, the win32 api
calls {Get,Set}SecurityDescriptor{Owner,Group}.  There is nothing in any
of the other libwin32 modules either, that I can see.  I also checked
CPAN to no avail.

Being Lazy and a win32 programming neophyte, I'd rather not try modifying
Win32::FileSecurity.  So, is there a module out there that does it?

Any pointers much appreciated,

John.
-- 
_/JohnL\_allen@gateway.grumman.com <Sun>: 9.5 billion pounds per sec to energy
~\Allen/~Fax: 516-575-7428    <Universe>: 1e22 stars = 22 solar masses per sec


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

Date: Thu, 20 Aug 1998 21:53:20 GMT
From: jffitzge766@my-dejanews.com
Subject: Perl search for directory structure
Message-Id: <6ri5sf$9a6$1@nnrp1.dejanews.com>

I need to make a search engine on a web site -but instead of searching
HTML files I need to search through actual files and directories in UNIX.

The problem is the size - there are 1000's of directories and files to
search through so doing a system call to "find" or "ls" takes WAY too long.

Wondering if there's an easy way to do this - thanks.

-justin@ucsd.edu

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


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

Date: 20 Aug 1998 21:19:45 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Perl Style
Message-Id: <903648603.32401@thrush.omix.com>

Scott Erickson <Scott.L.Erickson@HealthPartners.com> wrote:
        >snip<
: Please explain how I "made Tom's point exactly".

        You said quote, "If I was doing calculus, I would use math
        notation. But I am not, I am use Perl, so I will use Perl language
        constructs.".

        This is the point.  You are in Perl, but you try to avoid parts of
        the core language for arbitrary visual reasons alone and not for
        practical reasons.

: If you had read my postings in this
: thread, maybe you would have noticed that I had said that for some
: purposes, I think "or" is better than "||".

        No one is saying that || and or don't each have there place.  If
        they didn't they wouldn't be there.  We're questioning the reasons
        that you're using one over the other.  If you are using or over ||
        only because to English speaking people "or" "reads" easier, you
        are using it for the wrong reasons.  Like I said before, if ||
        doesn't say "or" to you just as fast as the English word "or", you
        simply don't have enough experience in C styled languages yet.  It
        should be second nature.  If it's not, you just need more
        experience with it.  This is true with any language, computer or
        otherwise.

: Also, are you implying that "||" is more primitive than "or"?

        No.  I was making the point about the use of symbols vs works ({} vs
        BEGIN BLOCK / END BLOCK stuff).

: It is my understanding that
: "or" is similar to "||", with a major difference being that "or" has
: much lower precedence than "||".

        Yes, exactly.  And this *alone* should be the basis to use one
        over the other in any given statement.  Any relationship to "or"
        also being an English word are secondary to that.

-- 
-Zenin (zenin@archive.rhps.org)           From The Blue Camel we learn:
BSD:  A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts.  Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.)  The full chemical name is "Berkeley Standard Distribution".


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

Date: Thu, 20 Aug 1998 21:19:13 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: Reading from file
Message-Id: <lp0D1.217$b16.1441558@news3.voicenet.com>

DesQuite <desquite@hotmail.com> wrote:
>section1
>data
>data
>section2
>data
>data
>section3
>data
>data
>
>I need to access section 2 and 3 and write them to the same page, but keep
>the data in separate arrays or something.  What is a good and easy way to do
>this and would it be easier if I wrote to the file a different way?  Thanks
>for your help.

The easiest way is to set the input record seperator variable $/.  Read
up on it in perlvar, you'll be glad you did!

#!/usr/local/bin/perl -w
use strict;

my %data = ();
local $/ = 'section';
<DATA>; # Toss the first occurance of $/ into the bit-bucket

while (defined(my $chunk = <DATA>)) {

    my @rows = split /\n/, $chunk;

    my $key = shift @rows;
    pop @rows if $rows[-1] eq $/;

    $data{$key} = \@rows;
}

for my $section (keys %data) {

    my $x = 0;
    print "$/ $section:\n";

    for my $row (@{$data{$section}}) {
        print "\t", $x++, ": ", $row, "\n";
    }
}


__END__
section1
data_1a
data_1b
section2
data_2a
data_2b
section3
data_3a
data_3b


-- 
Matt Knecht - <hex@voicenet.com>


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

Date: Thu, 20 Aug 1998 21:30:27 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: regex question: striphtml and misformed tags
Message-Id: <slrn6tp5bj.eub.adelton@aisa.fi.muni.cz>

On Thu, 20 Aug 1998 20:28:35 GMT, patrick@cre8tivegroup.com <patrick@cre8tivegroup.com> wrote:

> The problem is the [^>'"] * portion of the code.  If I remove the ", it works
> fine.  Why is this?  This works fine so long as there is 2 or more double
> quotes in the tag.  If there is only one, it won't remove that tag.

I believe it's the famous example from the Perl Journal by Jeffrey
Friedl. Your best bet is to remove that star from

	[^>'"] *

On my 5.00404, the original regexp doesn't even run, ending with
regexp *+ operand could be empty.

Hope this helps,

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


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

Date: 20 Aug 1998 22:23:53 GMT
From: kortbein@iastate.edu (Josh Kortbein)
Subject: Re: Returning an image from a call to a script
Message-Id: <6ri7lp$rkn$3@news.iastate.edu>

Alejandro Lay (gt2214a@prism.gatech.edu) wrote:
: Hi,

: Is there any way to call a perl script from inside an html file
: that returns an image that should be placed where the script was called
: from? (I lnow this can be done using SSI, but in this case the HTML
: file and the script are on two different servers). The other problem is
: that the server that runs the script runs perl 5.004 and does not have
: the CGI.pm module installed (I don't know why).

: The html file looks like this:
: <HTML><BODY>
: <IMG SRC="http://my.server.com/cgi/script.pl">
: </BODY></HTML>

: And the script looks like this:
: #!/usr/bin/perl
: require library.pl;

: print "Location: http://my.server.com/images/image.gif\n\n";
: &library'incrementCounter();

: I've also tried it with a: print "Content-Type: image/gif\n\n";
: line in it but it won't work. The script gets called because
: the counter is incremented.
: I know it can be done because I've seen it in action. Any help solving
: this problem would be greatly apreciated.
: TIA.
: Alejandro

A hackish way might be:

Have the HTML make an SSI call to the cgi (on the other server)
Have the CGI diddle with the image, however you like
	Store the image on the CGI server
	Return an IMG tag, where the SRC points to the image, in a file,
	on the CGI server

How useful this is sort of depends on whether or not you plan on
keeping the images around at all, or whether they're completely
totally generated on the fly.

FWIW, this has basically 0% relevancy to perl, so this was a bad
place to ask this question. Due to the nature of clpmisc's readership,
you probably just blew a big wad of your clpmisc karma.


cheers,

Josh

-- 
         "Writing is like prostitution.
          First you do for the love of it,
          Then you do it for a few friends,
          And finally you do it for money."
                 -Moliere



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

Date: Thu, 20 Aug 1998 17:39:13 -0400
From: "Joseph Kesselman, yclept Keshlam" <keshlam@us.ibm.com>
Subject: Re: Screen Scrubbing & Terminal Scripting
Message-Id: <35DC9781.337ECA80@us.ibm.com>

Since you asked in a Java newsgroup (in addition to the others):

I believe IBM's "Enterprise" edition of Visual Age for Java
includes classes for this purpose. Of course that's the most
expensive member of that product family...

-----------------------------------------------------------------
Joe Kesselman ("Keshlam"), http://www.lovesong.com/people/keshlam
     New URL for Walkabout Clearwater Coffeehouse and Chorus:
		http://www.lovesong.com/walkabout


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

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

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