[9286] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2881 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 16 07:07:58 1998

Date: Tue, 16 Jun 98 04:00:36 -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           Tue, 16 Jun 1998     Volume: 8 Number: 2881

Today's topics:
        5.004_04, SunOS4.14, GCC 2.7.2.3 ld/memmove compile pro kcary@my-dejanews.com
    Re: Accessing an NT share via CGI Perl Script <rlogsdon@io.com>
    Re: ascii to hex <jimbo@soundimages.co.uk>
    Re: Day of Week Display for User-defined date <jimbo@soundimages.co.uk>
    Re: diff-like utility in Perl? <jimbo@soundimages.co.uk>
    Re: Have we got a good free Perl manual? <pas@unh.edu>
    Re: How can I run Perl in Microsoft Access ? <quednauf@nortel.co.uk>
    Re: Is this insane? <jimbo@soundimages.co.uk>
    Re: linker counter <jimbo@soundimages.co.uk>
    Re: MAPI commands <guillaume@deepend.co.uk>
    Re: NEED PERL SCRIPTING <jimbo@soundimages.co.uk>
    Re: NT and Perl problems (Martien Verbruggen)
    Re: print <<END (with variables) <msazonov@usa.net>
        prob with *.txt file <bornes.marc@pophost.eunet.be>
    Re: Problem with MOMSpider <jasuther@dux.dundee.ac.uk>
    Re: Question about four-argument select use <jimbo@soundimages.co.uk>
        Read a filename from a file and open it <khalifa@cs.pitt.edu>
    Re: Read a filename from a file and open it <khalifa@cs.pitt.edu>
    Re: Read a filename from a file and open it <0x74_0x6F_0x64_0x64@0x40.0x7A.0x65.0x72.0x6F.0x6B.0x61.0x72.0x6D.0x61.0x2E.0x64.0x79.0x6E.0x2E.0x6D.0x6C.0x2E.0x6F.0x72.0x67>
    Re: Replacing multiple 'empty' lines <ajohnson@gpu.srv.ualberta.ca>
    Re: Replacing multiple 'empty' lines (Dan Lucas)
    Re: Replacing multiple 'empty' lines (Dan Lucas)
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
    Re: REVIEW: Perl CGI Programming - No Experience Requir (Rahul Dhesi)
        Simple pattern matching problem whizswift@my-dejanews.com
    Re: Simple pattern matching problem <quednauf@nortel.co.uk>
    Re: Simple Q - Splitting Array by Spaces (Patrick Timmins)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Tue, 16 Jun 1998 06:00:08 GMT
From: kcary@my-dejanews.com
Subject: 5.004_04, SunOS4.14, GCC 2.7.2.3 ld/memmove compile problem
Message-Id: <6m51l8$37u$1@nnrp1.dejanews.com>

Yikes! Having trouble figuring this one out (same failures with cc and 2.6.3
gcc):

ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o regcomp.o dump.o
util. o mg.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o
doop.o doio. o regexec.o taint.o deb.o universal.o globals.o perlio.o gcc
-B/bin/  -L/usr/local/lib -o miniperl miniperlmain.o libperl.a -lnsl -lgdbm
-ldbm -ldl -lm -lc -lposix ld: Undefined symbol  _memmove *** Error code 1
make: Fatal error: Command failed for target `miniperl'

Any help most gratefully received!

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 16 Jun 1998 04:14:35 -0500
From: REUBEN LOGSDON <rlogsdon@io.com>
To: vdaniels@syncsort.com
Subject: Re: Accessing an NT share via CGI Perl Script
Message-Id: <Pine.BSF.3.96.980616041211.9364C-100000@dillinger.io.com>


Configure your web server to run under a user or administrator account
instead of the guest account.  If you are in an NT domain you'll probably
need to use a domain account instead of a local machine account.

Regards,
Reuben Logsdon


On Tue, 16 Jun 1998, Vince Daniels wrote:

> I have a CGI that needs to access a file by way of a shared directory.
> When the
> program is executed from a browser the file (and infact the drive
> mapping or network path) is
> not found.  I understand that the difficulty lies in the fact that the
> script is being executed by
> a user that is not actually logged in and therefore has no network
> access.  My question is
> how does one get around this?
> 
> Vince Daniels
> 
> 
> 



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

Date: 16 Jun 1998 11:19:55 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: ascii to hex
Message-Id: <u67i13ayc.fsf@jimbosntserver.soundimages.co.uk>

Ala Qumsieh <aqumsieh@matrox.com> writes:

> Jason Oakley wrote:
> 
> >         How do i convert eg. "hello21" into it's hex equiv of each
> > character?
> > ------------
> Here's a one-liner:
> 
> $bit = unpack("H*", pack("A*", "hello21"));

Isn't "hello21" already packed into the format 'A*'? Do I need to
pack/unpack in order to achieve the desired result?

Jim Brewer


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

Date: 16 Jun 1998 10:09:57 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Day of Week Display for User-defined date
Message-Id: <u90mx3e6y.fsf@jimbosntserver.soundimages.co.uk>

fl_aggie@thepentagon.com (I R A Aggie) writes:

> In article <357C3050.3EBE6D1C@mindspring.com>, KC Lucchese
> <kcl@mindspring.com> wrote:
> 
> [to Abigail]
> + What a witch.  Your trailer park cancel bingo again, honey?

Definite bad form. Not particularly polite. Perhaps lacking in
manners. Certainley sarcastic and quite possibly uncalled
for. However, Abigail did use a form of words which implied an level
of contempt which may have been percieved as unnecessary as well as
leveled at the poster personally. I think most decent people would
feel taken aback by such a response. Not because it was *wrong*, as
you pointed out the answer was the *correct* one, but because it
seemed to be delivered at a personal level.

> With that sort of attitude, you won't be getting any answers to any
> of your questions in this newsgroup.

He may no longer be expecting any. Problem solved.

> 
> Abigail gave you a short, concise, and most importantly, a *correct*
> answer. What you want *is* in the documentation. That you're too lazy
> to find it out on your own is not anyone's problem but your own.

Now who is being abusive? Is this group strictly tit-for-tat? Must
every seeming act of violation be countered by same? 

You must share a great deal in common with Uri Geller. I say this
because you know the poster is not just lazy, but too lazy. How in the
world were you able to assess this from the information provided?

> But don't abuse people simply because they don't give you the answer
> that you want.

Once again, you must be doing a Uri Geller. How do you know he didn't
get the answer he wanted? He commented, most certainly at a personal
level, about the form in which the answer was provided. What he did
not say, so you could not possibly know, was whether his question was
answered.

Further, Abigail's post only required the last line to be many of the
things valued in Perl: Concise, correct, useful.

Jim Brewer


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

Date: 16 Jun 1998 07:58:36 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: diff-like utility in Perl?
Message-Id: <uwwah96jn.fsf@jimbosntserver.soundimages.co.uk>

Gellyfish@btinternet.com (Jonathan Stowe) writes:

> I must admit that I took the original posters question to mean whether
> it was possible to fulfill a lack of "diff" on the Windows platform
> with something written in Perl - which is of course unnecessary.  

Just to stir it a bit: Where in the original post was Windows, or any
OS, made? Or any mention of a lack of 'diff'? The answer was pretty
simple by the looks of the responses. Sorry sir, no such function
exists, please try later.

Jim Brewer



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

Date: 16 Jun 1998 10:15:35 GMT
From: Paul A Sand <pas@unh.edu>
Subject: Re: Have we got a good free Perl manual?
Message-Id: <6m5gk7$vcv@mozz.unh.edu>

birgitt@my-dejanews.com writes:
>In article <6m34u4$ohq@mozz.unh.edu>, pas@unh.edu wrote:

>> Is there some reason to pretend that RMS *doesn't*, at base, view this
>> as a moral issue? I suppose it's easy to forget that, or not know it in
>> the first place. A few weeks back, Barry Margolin reminded me (gently)
>> that:

>>     In RMS's ideal world, people wouldn't feel the need to own
>>     software, so they wouldn't consider the above right an interesting
>>     thing to have.  Just as 200 years ago slavery was considered normal
>>     by many people, but now it's considered abhorent.  RMS wishes for a
>>     society in which intellectual property is considered as wrong as
>>     human property.


>I would then remind you all gently that RMS ideal world where human
>and intellectual property is considered wrong, has been tested
>out in real life in the former German Democratic Republic for some
>forty years or so.

Just to clarify, by ``human property'' Barry was referring to slavery.
Which I (and perhaps this poster) would contend was all too present
in the bad old GDR. 

I am actually a pretty rabid libertarian/capitalist type myself; but
the discussion is about RMS/FSF/GNU's views, not mine.

-- 
-- Paul A. Sand                 | We have a hammer.
-- University of New Hampshire  | Your problem is a nail.
-- pas@unh.edu                  |     (Larry Ellison)
-- http://pubpages.unh.edu/~pas | 


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

Date: Tue, 16 Jun 1998 10:56:04 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: How can I run Perl in Microsoft Access ?
Message-Id: <35864133.49F77AFD@nortel.co.uk>

Henry Ng wrote:
> 
> Hi,
>         My name is Finie, how can I run Perl in Microsoft Access ?


Hi Henry Finie the Ng, nice to meet you,
You politely ask Bill if he would give you the Microsoft Access source code.
Then you could try to embed Perl in it. Or maybe you want to talk to Access with
Perl, then you could use Win32::OLE or Win32::ODBC . The OLE module comes with
the GS - win32 port these days... ask your local Perl dealer or CPAN.

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: 16 Jun 1998 11:57:32 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Is this insane?
Message-Id: <u1zsp397n.fsf@jimbosntserver.soundimages.co.uk>

steve@vertigan.iinet.net.au (Steve Vertigan) writes:

> Hi.  I've just written a spiffy (cgi/linux) application that my boss wants 
> me to get running on an NT server that doesn't have a Perl interpreter 
> installed.  It occurred to me that one way would be to compile the Perl code 
> into C using the compiler and then to compile that C using the GNU compiler 
> for win32.  10 hours and one miserly test.c file that wont compile later I'm 
> starting to wonder if it was such a brilliant idea after all.  Has anyone 
> managed to do something like this successfully or is there an easier way to 
> do things?

Another useless thought: Why not run the scripts from YOUR linux
box. If the scripts don't need to be located in a specific spot then
why not run them from your place, sell the client a support contract
and every one is a winner. Point out that the ISP is not capable of
providing the necessary support for the application and with the
scripts running on your server they are BOUND to get a more reliable
and robust application.

Jim Brewer



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

Date: 16 Jun 1998 11:24:49 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: linker counter
Message-Id: <u4sxl3aq6.fsf@jimbosntserver.soundimages.co.uk>

Andy Chantrill <support@derby-county.com> writes:

> 
> i need a script to count how many times each unique visitor clicks on a
> small graphic link to get to my site....i need to be able to see how
> many times for each member of mu little link program...yoiu knoiw i pay
> 5c per every click through....i just need a simple script thats all....
> 
> reply to support@u2me3.com
> 
> cheers,
> Andy.

Dear Andy, this is not a contract programming solicitation
group. Perhaps you would be better served by posting this request in a
jobs group? If you would like to give it a go yourself, get Perl, read
the faq and man pages that come with Perl and fire up your editor and
have fun!!!

Jim Brewer



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

Date: Tue, 16 Jun 1998 10:54:00 +0100
From: Guillaume Buat-Menard <guillaume@deepend.co.uk>
Subject: Re: MAPI commands
Message-Id: <358640B7.65C49818@deepend.co.uk>

Thanks for your advices Tom.

I tried to find answers in FAQs, on the microsoft site, I'm on a news group
about MAPI but it seems like the people developping with MAPI are doing it
with VB or C++ and none for CGI.
Each time I saw some stuff about email on NT they were using the NET:SMTP
package or other developped software.
I'm actually using 'Blat' on NT and it works with CGI. The problem is that I
have some CGI scripts to upload on a web site (using E-mail) with a provider
using NT and MAPI but the techy guy couldn't help me with what command I
should use that's why I don't have the documentation.

Cheers,

Guillaume.



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

Date: 16 Jun 1998 11:49:28 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: NEED PERL SCRIPTING
Message-Id: <u3ed539l3.fsf@jimbosntserver.soundimages.co.uk>

"ALAN FEILER" <ppdc@ix.netcom.com> writes:

> 
> Not certain on  pay but will consider workout.
> I have new startup application require perl scripting to
> automate thru unix server orders.
> 1. script to create client page,split with vendor reply
> 2. scrpt to validate credit card payment, and report.
> 3. script to store orders in unique bin and summarize quantiity ,
> then    move bin contents to appropriate vendor.
> Please email me your phone # so we can tall further about
> implementation.

This is not an employment center. Sorry. There are better groups for
these requests. Please use them as you will get the response you
desire and not the response you would rather do without.

Jim Brewer



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

Date: 16 Jun 1998 04:40:56 GMT
From: mgjv@comdyn.com.au (Martien Verbruggen)
Subject: Re: NT and Perl problems
Message-Id: <6m4t0o$64n$2@comdyn.comdyn.com.au>

Please read the following information on how to choose a good subject
line:

http://www.perl.com/CPAN/authors/Dean_Roehrich/subjects.post


In article <VMhh1.7$zQ1.486055@newsread.toronto.istar.net>,
	"Kevin Jones" <kjones@inforamp.net> writes:

> 1.  With NT 4, do I have to also install HTTPS.EXE?

HTTPS.EXE is not part of perl, and has nothing to do with perl. It
looks like it might be part of a web server. Ask in the appropriate
group.

> 2.  The "POST" method in forms, gets the http error 405 "Method Not
> Allowed".  Is this because HTTPS is not installed?  or am I missing
> something.

Again, this is a question about HTTP, or your web server. Nothing to
do with perl.

> 3.  If I install HTTPS on NT4, do I need to edit the registry, or just
> map the MIME type.

Once again. A web server configuration issue.

> 4.  What should be entered for the MIME settings, I guess PL would
> obviously be the extension, but what about the rest?

And again: a question about your web server, NOT about perl.

> Any help would be appreciated.

The only help we can give you on this group is a pointer to a place
where you might have more chance of getting questions like these
asked. There is a whole hierarchy of groups under
comp.infosystems.www.* which are devoted to the WWW, HTTP, CGI, Web
servers, etc. You should ask your question there. 

Perl is a programming language. Not a web tool.

Martien
-- 
Martien Verbruggen                  | 
Webmaster www.tradingpost.com.au    | The gene pool could use a little
Commercial Dynamics Pty. Ltd.       | chlorine.
NSW, Australia                      | 


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

Date: Tue, 16 Jun 1998 12:02:11 +0400
From: "Michael Sazonov" <msazonov@usa.net>
Subject: Re: print <<END (with variables)
Message-Id: <6m58pf$fg6@xpress.inforis.nnov.su>


David Wasserstrum wrotes in message
<3585F953.B270498A@gti.com> ...
>...
>print <<"END";
>...
>src="graphics/button$a_left.gif"></tr>
This
src="graphics/button$a\_left.gif"></tr>
Should help.

Mike





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

Date: Tue, 16 Jun 1998 11:39:01 +0200
From: "Marc Bornes" <bornes.marc@pophost.eunet.be>
Subject: prob with *.txt file
Message-Id: <6m5egf$nve$1@news3.Belgium.EU.net>


I NEED YOUR HELP,

WHEN A  FILE IN FORMAT *.TXT IS DISPLAYED ON THE SCREEN HOW CAN I FREEZE THE
TWO FIRST LINES AS HEADINGS.

THANK YOU FOR YOUR HELP

HERE IS THE SOURCE CODE :

&header;
print <<"HTML";
<H1> Research on "$contents{'keyword'}": </H1>
<HR><P>
<TABLE>
HTML
$count=0;
@sorted = sort(<BOOK>);
foreach $pair (@sorted)
{

 if ($pair =~ /$contents{'keyword'}/gi)


     $count++;
     @entry = split(/,/, $pair);
     print
"<TR><TD><b>$entry[0]</b></TD><TD>$entry[1]</a></TD><TD>$entry[2]</a></TD><T
D>$entry[3]</b></TD><TD>$entry[4]</b></TD><TD>$entry[5]</b></TD><TD>$entry[6
]</b></TD><TD>$entry[7]</b></TD><TD>$entry[8]</b></TD><TD>$entry[9]</b></TD>
<TD>$entry[10]</b></TD><TD>$entry[11]</b></TD><TD>$entry[12]</b></TD><TD>$en
try[13]</b></TD><TD>$entry[14]</b></TD><TD>$entry[15]</b></TD><TD>$entry[16]
</b></TD><TD>$entry[17]</b></TD><TD>$entry[18]</b></TD><TD>$entry[19]</b></T
D></TP>";
    }

}
if ($count==0)
  {
   print "Nothing with your reference";
  }
close(BOOK);
--
BORNES MARC
Bornes.marc@pophost.eunet.be
kidcool@pophost.eunet.be
K.C. EUROPE
KIDCOOL
25-27 Square de l'aviation
1070 Bruxelles
Belgium
Til.: 32 2 558.18.90
Fax.: 32 2 521.37.24




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

Date: Tue, 16 Jun 1998 10:44:10 +0100
From: James Sutherland <jasuther@dux.dundee.ac.uk>
Subject: Re: Problem with MOMSpider
Message-Id: <35863E6A.F8F3FC89@dux.dundee.ac.uk>

OK, so I can:
1. Install Perl4
2. Convert MOMSpider to Perl5
3. Ditch MOMSpider and write my own link-checker.

1. I can't really install Perl4 again on the WWW server.
2. Hmm. Big undertaking, but then that's what I thought when I fixed
WebCopy to handle redirects.
3. Write my own checker? No thanks. That would be a BIG job and a half..

OK, so I'll re-write MOMSpider to use Perl5. If anyone out there has
started on this, or has any info on porting 4->5, please let me know!

James Sutherland


Joe McMahon wrote:
> 
> In article <3580EBAB.21C12688@dux.dundee.ac.uk>, James Sutherland
> <jasuther@dux.dundee.ac.uk> wrote:
> 
> >HELP!
> >
> >I have just installed MOMSpider on the University WWW server. After
> >installing it and creating an instruction file, I get:
> >Undefined subroutine &main::AF_INET called at lib/wwwhttp.pl line 106.
> >
> >Where can I find &main::AF_INET? Some of the standard libraries refer to
> >AF_INET, but I can't find any sort of definition.
> >
> >
> >While I like and use Perl, I've not been using it all that long - what's
> >up here? BTW, the homepage for MOMSpider says the program needs Perl4 -
> >would that mean it can't run under Perl5? That would be a little odd,
> >surely?
> Yes, it does mean that. Your choices are: install perl4 (somewhere where
> only MOMSpider will use it), convert MOMSpider to perl5 (and win undying
> gratitude from a lot of people who will finally be able to delete perl4),
> or toss it out and write a custom spider using LWP (see Randal's Web
> Techniques columns for a simple program you can build on).
> 
>  --- Joe M.


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

Date: 16 Jun 1998 10:27:02 +0100
From: Jim Brewer <jimbo@soundimages.co.uk>
Subject: Re: Question about four-argument select use
Message-Id: <u7m2h3deh.fsf@jimbosntserver.soundimages.co.uk>

Lou Poppler <lwp@flenser.ibm.net> writes:

> Are you sure that NT supports this (or any) form of select() ?

The networking and messaging examples in Advanced Perl Programming use
the four argument select and they worked on my NT box. The four
argument select with four undef values does not work on my NT box.

Jim Brewer



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

Date: Tue, 16 Jun 1998 03:47:57 -0700
From: Yasir Khalifa <khalifa@cs.pitt.edu>
Subject: Read a filename from a file and open it
Message-Id: <35864D5D.6BC1@cs.pitt.edu>

Hi:

Can anyone help! I have a file called lastname.html (which changes
according to the last name of the user using the system). The name 
of this file is stred in a temp file (HTMLFILE), which includes only 
one line (the filename lastname.html).

The Perl code below, reads the contents of the file HTMLFILE
and assigns it to a variable $htmldatafile. Now, I want Perl/CGI
to display the file $htmldatafile but it complains. No file is
displayed.  Any help is appreciated.
-------------------
#!/usr/local/bin/perl

require "read_tools.pl";

print "Location: $htmldatafile"," \n\n";

$tmpfile="HTMLFILE"; #this file includes a filename called username.html


if (open(HTFILE, "<".$tmpfile)){
        select(HTFILE);
        $htmldatafile = <HTFILE>;   #read the the contents of HTFILE
        close(HTFILE);              #and assign it to $htmldatafile,
                                    #which is now username.html
}else {
        print "Cannot read from file: $tmpfile","\n";
      }


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

Date: Tue, 16 Jun 1998 03:55:08 -0700
From: Yasir Khalifa <khalifa@cs.pitt.edu>
Subject: Re: Read a filename from a file and open it
Message-Id: <35864F0C.2FBE@cs.pitt.edu>

The filename inside the code of the previous message: username.html
should be lastname.html
Thnaks -YK


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

Date: 16 Jun 98 10:24:20 GMT
From: Todd Santos <0x74_0x6F_0x64_0x64@0x40.0x7A.0x65.0x72.0x6F.0x6B.0x61.0x72.0x6D.0x61.0x2E.0x64.0x79.0x6E.0x2E.0x6D.0x6C.0x2E.0x6F.0x72.0x67>
Subject: Re: Read a filename from a file and open it
Message-Id: <358647d4.0@206.170.198.12>

Yasir Khalifa got drunk in comp.lang.perl.misc and spewed as such:
: Hi:

: Can anyone help! I have a file called lastname.html (which changes
: according to the last name of the user using the system). The name 
: of this file is stred in a temp file (HTMLFILE), which includes only 
: one line (the filename lastname.html).

: The Perl code below, reads the contents of the file HTMLFILE
: and assigns it to a variable $htmldatafile. Now, I want Perl/CGI
: to display the file $htmldatafile but it complains. No file is
: displayed.  Any help is appreciated.


change line 7 to:
	chomp( $htmldatafile = <HTFILE> );

(line 7)
:         $htmldatafile = <HTFILE>;   #read the the contents of HTFILE


if you didn't already chomp it, there was a newline on the end of it, which
means you were trying to open "foo\n" instead of "foo".

HTH.
								- Todd
-- 
Todd Santos :: Just Another Aspiring Perl Hacker :: todd@zerokarma.dyn.ml.org
         ...Yeah, I know I have a munged From: header. I was bored.


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

Date: Tue, 16 Jun 1998 02:06:39 -0500
From: Andrew Johnson <ajohnson@gpu.srv.ualberta.ca>
Subject: Re: Replacing multiple 'empty' lines
Message-Id: <3586197F.27BF1D27@gpu.srv.ualberta.ca>

Dan Lucas wrote:
> 
> My apologies in advance for this beginner's FAQ.
> 
> I have a number of text files containing multiple 'empty' lines, which
> are lines containing just a newline. I want to replace bunches of 2 or
> more empty lines with one empty line.
> 
> If the file was placed in a single string (each line concatenated onto
> a string as read), my tentative approach would be to do a
> s/\n\n\n+/\n/m (<-? sorry, I forget the 'multiple line string' switch)
> on the string and then write it back out to a file. It seems to me
> that this would work, although one might run into trouble with a very
> large file (unlikely, and would be checked first anyway).
> 
> However, this seems an unnatural and rather 'brute force' way to do
> it. Another way would perhaps be to read the file into an array, loop
> through the array, check to see if both the current line and the
> previous one are empty then delete one or the other. This doesn't seem
> very elegant either.
> 
> Can anybody suggest a better, more Perl-ish way to replace these
> multiple \n lines with a single \n?

sounds like a job for the $/ variable, or the equivalent -0 switch,
see 'perldoc perlvar' and 'perldoc perlrun' respectively.

does:
perl -p00 -e 1 oldfile > newfile
or
perl -p00 -i.bak -e 1 oldfile

do something like what you wanted?

regards
andrew


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

Date: Tue, 16 Jun 1998 07:35:49 GMT
From: dlucas@deletethis.gol.com (Dan Lucas)
Subject: Re: Replacing multiple 'empty' lines
Message-Id: <35861e44.88145696@nnrp.gol.com>

On 16 Jun 1998 05:44:51 GMT, cberry@cinenet.net (Craig Berry) wrote:

>Rather than concatenating lines as you read them, it's far easier to
>(locally) undefine $/ and read the entire file into a scalar in a single
>'$text = <FILE>' operation.

Thanks very much for the tip and the tweaked regex. I wasn't really
aware of this angle of attack since I still haven't got the hang of
these special variables yet. You don't see many in Visual Basic. The
files are not large (<30k and most <5k) so I shall use the
substitution approach now that it has been 'sanctioned' by somebody
else.

Cheers,
Dan Lucas
Osaka
Japan



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

Date: Tue, 16 Jun 1998 07:38:03 GMT
From: dlucas@deletethis.gol.com (Dan Lucas)
Subject: Re: Replacing multiple 'empty' lines
Message-Id: <35862006.88595974@nnrp.gol.com>

On Tue, 16 Jun 1998 02:06:39 -0500, Andrew Johnson
<ajohnson@gpu.srv.ualberta.ca> wrote:

>> Can anybody suggest a better, more Perl-ish way to replace these
>> multiple \n lines with a single \n?
>
>sounds like a job for the $/ variable, or the equivalent -0 switch,
>see 'perldoc perlvar' and 'perldoc perlrun' respectively.

Great, chimes in with Craig's suggetsion.

>does:
>perl -p00 -e 1 oldfile > newfile
>or
>perl -p00 -i.bak -e 1 oldfile
>
>do something like what you wanted?

I don't know to be honest - but I'll study the llama and gecko books
this evening in an attempt to find out. :-)

Thanks,

Dan Lucas
Osaka
Japan




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

Date: 16 Jun 1998 10:04:45 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6m5fvt$j4f$1@samba.rahul.net>

In <pudge-1406982115300001@192.168.0.3> pudge@pobox.com (Chris Nandor) writes:

>In article <6lspgm$ikt$1@samba.rahul.net>, c.c.eiftj@54.usenet.us.com
>(Rahul Dhesi) wrote:

># The only difference between a list and an array that I can think of is
># that we call a list an array if we use subscript notation on it at least
># once in a program.  So the difference appears to be what we do, not what
># it is.

>No, a subscripted list is still a list.

>  print join("",
>    (split
>      (//, (`perl -v`)[1])
>    )[11,19,14,15]
>  );

>Here we put a subscript on the contents of `perl -v`, split that line into
>a list, and subscript that list, and neither is an array.

By my definition it is.
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: 16 Jun 1998 10:11:33 GMT
From: c.c.eiftj@54.usenet.us.com (Rahul Dhesi)
Subject: Re: REVIEW: Perl CGI Programming - No Experience Required
Message-Id: <6m5gcl$j78$1@samba.rahul.net>

In <5q67i2n50r.fsf@prometheus.frii.com> Nathan Torkington
<gnat@frii.com> writes:

>sub screw_you {
>    if (@_) {
>	return ("this", "is", "a", "list");
>    } else {
>	my @a = ( "this", "is", "an", "array" );
>	return @a;
>    }
>}

>$a = screw_you();
>$b = screw_you( "dear" );

>print "$a\n$b\n";

>__END__
>This prints
>	list
>	4

>Lists and arrays are not interchangable.

The above example simply tells us that perl code behaves in a certain
way.  It doesn't tell us that lists and arrays are not interchangeable.
If you follow my naive definition (that a list is an array if you use
subscript notation on it at least once) then nothing in the sample code
above is an array.

To show that lists and arrays are different, you would have to (a) have
a good unambiguous definitions of 'list' and 'array', and *then* show
that they behave differently.  Until you have such definitions no amount
of perl code will prove anything.
-- 
Rahul Dhesi <dhesi@spams.r.us.com>


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

Date: Tue, 16 Jun 1998 07:09:22 GMT
From: whizswift@my-dejanews.com
Subject: Simple pattern matching problem
Message-Id: <6m55n2$8g2$1@nnrp1.dejanews.com>

I have string which looks like this:
<!--something 10--><li>xyz</li><!--someotherthing 20-->somewords
when i use
$string =~ s/<!--(.*)-->//g

it returns only "somewords"
but what happened to <li>xyz</li> ?
My hunch is the pattern match occurs from
<!--something 10--> to <!someotherthing 20-->
everything between it is replaced with nothing.

Please tell me, how can I remove all comments tags from a HTML and display it
(i don't want to save it)

please reply as email.....

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

Date: Tue, 16 Jun 1998 09:47:34 +0100
From: "F.Quednau" <quednauf@nortel.co.uk>
Subject: Re: Simple pattern matching problem
Message-Id: <35863126.219AF750@nortel.co.uk>

whizswift@my-dejanews.com wrote:
> 
> $string =~ s/<!--(.*)-->//g
> 
> it returns only "somewords"
> but what happened to <li>xyz</li> ?

The regexpesses are greedy by default, so it matches as much as it can. In this
case up to the last '>'. You can set the regexp to be non-greedy, matching as
little as possible. Try this (untested): $string =~ s/<!--(.*?)-->//g . If
wrong, check the docs.

> Please tell me, how can I remove all comments tags from a HTML and display it
> (i don't want to save it)

You might try html::parser from CPAN.

> 
> please reply as email.....

As your email account is also on dejanews, you might as well read the
newsgroups.

-- 
____________________________________________________________
Frank Quednau               
http://www.surrey.ac.uk/~me51fq
________________________________________________


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

Date: Tue, 16 Jun 1998 07:35:53 GMT
From: ptimmins@netserv.unmc.edu (Patrick Timmins)
Subject: Re: Simple Q - Splitting Array by Spaces
Message-Id: <6m578p$bb6$1@nnrp1.dejanews.com>

In article <3585CFAA.AABB29E0@savalas.com>,
  Jesse Rosenberger <jesse@savalas.com> wrote:
>
> I have a real simple question...(I think)...and I know that I know how
> to do this, but I have not done it for sometime now.  I have an array
> called @options, it contains several numbers seperated by spaces (i.e.
> 62 63 65 67 69 70 81 96) the numbers may vary everytime.  I need to be
> able to have the script print an <option> tag for each one:
>
> <option>62
> <option>63
> <option>65
> <option> etc, etc...
>
[snip]

Can we see some examples of your code? Do you have an array @options or not?
Can we see it? Do you mean you have a string with numbers separated by spaces
that you want to put into an array? If so, how about:

@options = qw(62 63 65 67 69 70 81 96 etc whatever);
foreach $options (@options) { print "<option>$options\n" }

You can save yourself alot of time by "re-learning" all of this for yourself.

Good luck in all your endeavors in life. I hope you achieve all that your
efforts warrant.

Patrick Timmins
U. Nebraska Medical Center

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/   Now offering spam-free web-based newsreading


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

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


Administrivia:

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

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

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

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

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

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

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

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


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

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