[9584] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3178 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 16 14:11:16 1998

Date: Thu, 16 Jul 98 11:00:39 -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, 16 Jul 1998     Volume: 8 Number: 3178

Today's topics:
        %vHash = $vScalar doesn't work, why? (Scott Cherkofsky)
    Re: %vHash = $vScalar doesn't work, why? (Aaron B. Dossett)
    Re: %vHash = $vScalar doesn't work, why? (Steve Linberg)
    Re: client/server help 2 (Joseph M Carlton)
    Re: client/server help (Joseph M Carlton)
    Re: Connecting to MS Access DB on NT from Linux/Apache (Steve Linberg)
    Re: efficiency: print<<"xxx" vs. print <uri@sysarch.com>
    Re: efficiency: print<<"xxx" vs. print (Matt Knecht)
        German phone system was "Putting CPAN on a CD: good or  <simon@new-mediacom.com>
    Re: HELP : Integrating an Access DB with Perl (Steve Linberg)
        IF statement NOT BROKEN in 5.004! <wcatlan@bccom.com>
    Re: Is it possible to create a STAND ALONE EXECUTABLE? <Christopher.Marquis@fairchildsemi.com>
        MIME types ku@my-dejanews.com
        MIME types ku@my-dejanews.com
    Re: newbie date format (Matt Knecht)
    Re: Please Help Me! (Matt's Script BB Problem) (Chris Nandor)
    Re: Problem writing an output file (Steve Linberg)
    Re: Q: Changing IP address via perl <nospam@cs.umd.edu>
    Re: Regexp to handle \\n\n\n (brian d foy)
    Re: Removing the ^M character <daved@orion.tamu.edu>
    Re: Restricting refering domains access to script? (brian d foy)
    Re: Restricting refering domains access to script? (brian d foy)
        Return value of eval() livshits@acm.org
    Re: Return value of eval() (Steve Linberg)
    Re: use strict <joneil@cks.ssd.k12.wa.us>
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: 16 Jul 1998 13:33:16 -0400
From: crusader@bilbo.ShireNet.com (Scott Cherkofsky)
Subject: %vHash = $vScalar doesn't work, why?
Message-Id: <6oldgs$av4@bilbo.ShireNet.com>


I've got a simple problem that's been driving me bonkers.  why doesn't 
the following code work?

	$vSDFGuts = "NAME,Scott,DESC,5ft10inches";
	%hSDFInfo = $vSDFGuts;

I can't get $hSDFInfo{NAME} to give me back Scott!

any help would be muchly appreciated.  Ya know, its funny but in all of 
the Nutshell books on PERL, not one of them (and I have 3) mentions or 
gives examples for populating HASH's using Scalar variables containing 
comma delimited values.

Scott
-- 
____________________________________________________________________________
  Scott   |   scottc1033 aol com  | Need Interenet access in Virginia?
Cherkofsky|crusader shirenet com  |  Try Shirenet <mailto:info@shirenet.com>
'Crusader'|HomePage:    http://www.shirenet.com/~crusader/html/Home.html


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

Date: 16 Jul 1998 17:52:11 GMT
From: aarond@alpha.ewl.uky.edu (Aaron B. Dossett)
Subject: Re: %vHash = $vScalar doesn't work, why?
Message-Id: <6olekb$3mj$1@service3.uky.edu>

Scott Cherkofsky (crusader@bilbo.ShireNet.com) wrote:
> 
> I've got a simple problem that's been driving me bonkers.  why doesn't 
> the following code work?
> 
> 	$vSDFGuts = "NAME,Scott,DESC,5ft10inches";
> 	%hSDFInfo = $vSDFGuts;
> 
> I can't get $hSDFInfo{NAME} to give me back Scott!

Try this.

%hSDFInfo = split /,/, $vSDFGuts;

You can't populate a hash with a single scalar.

-- 
Aaron B. Dossett   |   Finger aarond@london.cslab.uky.edu for PGP key
dossett@bigfoot.com|      
Comp. Sci. Senior  |         http://www.ewl.uky.edu/~aarond
    University of Kentucky    1996 & 1998 NCAA Basketball Champions


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

Date: Thu, 16 Jul 1998 13:58:23 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: %vHash = $vScalar doesn't work, why?
Message-Id: <linberg-1607981358230001@projdirc.literacy.upenn.edu>

In article <6oldgs$av4@bilbo.ShireNet.com>, crusader@bilbo.ShireNet.com
(Scott Cherkofsky) wrote:

> I've got a simple problem that's been driving me bonkers.  why doesn't 
> the following code work?
> 
>         $vSDFGuts = "NAME,Scott,DESC,5ft10inches";
>         %hSDFInfo = $vSDFGuts;
> 
> I can't get $hSDFInfo{NAME} to give me back Scott!

Of course not.  You didn't put anything into $hSDFInfo{NAME}, so why
should it give you anything back?

Try this:

$hSDFInfo{"NAME"} = "Scott";

You can't equate a scalar and a hash.  "NAME,Scott,DESC,5ft10inches" is a
scalar string.  Maybe you were thinking of

%hSDFInfo = "NAME", "Scott", "DESC", "5ft10inches";

See the difference?

> any help would be muchly appreciated.  Ya know, its funny but in all of 
> the Nutshell books on PERL, not one of them (and I have 3) mentions or 
> gives examples for populating HASH's using Scalar variables containing 
> comma delimited values.

The Camel, and the free documentation on your system, go into this in
depth.  Read up!  :)
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: 16 Jul 1998 17:22:04 GMT
From: carltjm@mail.auburn.edu (Joseph M Carlton)
Subject: Re: client/server help 2
Message-Id: <6olcrs$7c0$1@ultranews.duc.auburn.edu>

Well, I finally got the client/server examples in the book working.  I'm 
just trying to get the socket and table search working  before I try to 
do it through the web.  I need to send an id number to the server, so it 
can do the table search and return the data.  Does anyone know how I send 
the ID number?  Is in done with the connect statement or is there some 
other command to send it in?  

Thanks,
Joey

Joseph M Carlton (carltjm@mail.auburn.edu) wrote:
: From page 354 of Programming Perl:
: "For example, let's say that you have a long running database server 
: daemon that you want folks from the World Wide Web to be able to
: access, but only if they go through a CGI interface. You'd have a small, 
: simple CGI program that does whatever checks and logging you feel
: like, and then acts as a Unix-domain client and connects to your private 
: server. "

: This is EXACTLY what I need to do.  But I don't know how to get the 
: client and server working.  Someone please help.  See also my other posts.
: Thanks.

: --

: Joey Carlton
: Senior, Computer Engineering
: Auburn University
: carltjm@mail.auburn.edu

--

Joey Carlton
Senior, Computer Engineering
Auburn University
carltjm@mail.auburn.edu


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

Date: 16 Jul 1998 17:01:08 GMT
From: carltjm@mail.auburn.edu (Joseph M Carlton)
Subject: Re: client/server help
Message-Id: <6olbkk$75h$1@ultranews.duc.auburn.edu>

Mark Maurer (mwmaurer@pace1.cts.mtu.edu) wrote:

: As for your other errors, get ahold of a copy of "programming perl", or check
: the perl website, to see what the errors mean and how to correct them.  But I
: suggest checking over your code to make sure it is exactly like the code in
: the book first.

Yeah, I had a typo.  I had used an 1 instead of an l, so it took me 
forever to find that.  I couldn't get the UNIX-domain one to work, but 
did get the TCP one to work.  Could someone explain what the difference is?

I personally think that the UNIX-domain client and server examples are 
bad examples, because it doesn't tell you what that file is or what is in 
it.  

--

Joey Carlton
Senior, Computer Engineering
Auburn University
carltjm@mail.auburn.edu


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

Date: Thu, 16 Jul 1998 13:12:36 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Connecting to MS Access DB on NT from Linux/Apache
Message-Id: <linberg-1607981312360001@projdirc.literacy.upenn.edu>

In article <6oj6jq$5m6$1@camel15.mindspring.com>, "Doug Younger"
<cgi-bin@mindspring.com> wrote:

> Hello,
> 
> I'm pulling my hair out over this... I can't seem to find a straight answer
> on how to do this...
> 
> I need to be able to query and insert data into a MicroSoft Access DB on a
> NT 4.0 server  from a Linux (Debian 1.2/2.0.34) machine using perl.
> (preferably perl, other methods could be considered)
> 
> I've seen references to DBI, DBD::ODBC, and win32 modules and I'm not sure
> what is needed where. I've also seen some FAQ's that say it's not possible
> to access a remote server using DBI.
> 
> (I'm kind of hoping it's not possible so I can tell "them" that it can't be
> done and I can move the DataBase to PostgreSQL on the linux box).

So you have an NT server hosting an Access database?  You can certainly
write pages/scripts on the NT server side that allow you to interact with
the Access database from web pages; then you can do it from anywhere.  If
you want to access the NT-hosted Access database using Perl running on a
Linux box, I've never heard of a way to do this.  Not without some coding
on the NT side, at least.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: 16 Jul 1998 13:09:49 -0400
From: Uri Guttman <uri@sysarch.com>
To: mjd@op.net (Mark-Jason Dominus)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <x7vhoxn2n5.fsf@sysarch.com>

>>>>> "MD" == Mark-Jason Dominus <mjd@op.net> writes:

  MD> Have you ever read the book that this comes from, _Principles of
  MD> Program Design_?  It's absolutely brilliant, but it doesn't seem
  MD> to be very well-known.

  MD> Jackson's theory is that the formal structure of your program
  MD> should match the structure of the input it will process.  The
  MD> structure of the program should also match the structure of the
  MD> output it is required to generate.  The interesting programs must
  MD> handle an input and an output that have different structures.
  MD> Jackson describes methods for recognizing this structure and
  MD> abstracting a program structure that corresponds to the input and
  MD> to the output at the same time.

i have been espousing that theory of program design for years without
having read that book. i have said a program's design should reflect its
function, not just implement it. you can implement (via emulation, etc.)
any functionality you want, but a design that matches the functionality
is the most maintainable.

i have much more on this topic but that is for another thread.

  MD> I think the book would have been a lot more well-known than it is,
  MD> except that all the examples are in COBOL.

well, that is a very good way to make a book disappear into /dev/null!
maybe it should be rewritten with perl as the example code! in fact that
makes for an interesting topic, how to write perl that reflects a
function and not just being hyper efficient, obscure, cute, or
whatever. since TIMTOWTDI, which is the (subjective) best way? fastest,
shortest code, easiest for beginners to grok, most reflective of the
function, etc?

maybe a BOF at the conference on this topic would be cool. any others
interested in this thread?

uri


-- 
Uri Guttman  -----------------  SYStems ARCHitecture and Software Engineering
Perl Hacker for Hire  ----------------------  Perl, Internet, UNIX Consulting
uri@sysarch.com  ------------------------------------  http://www.sysarch.com
The Best Search Engine on the Net -------------  http://www.northernlight.com


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

Date: Thu, 16 Jul 1998 17:42:45 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <pYqr1.144375$on1.7161739@news2.voicenet.com>

Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "MD" == Mark-Jason Dominus <mjd@op.net> writes:
>  MD> Jackson's theory is that the formal structure of your program
>  MD> should match the structure of the input it will process.  The
>  MD> structure of the program should also match the structure of the
>  MD> output it is required to generate.  The interesting programs must
>maybe a BOF at the conference on this topic would be cool. any others
>interested in this thread?

Yes, but I've never heard of it before.  I make programs that work, and
I'm always trying to make them look cleaner, and easier to understand
(Sometimes at the expense of run time).  I've always tried to accomplish
this through use of comments, and taking the clearer (If sometimes more
wordy) approach.

-- 
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"


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

Date: Thu, 16 Jul 1998 18:26:29 +0100
From: Simon Matthew Wistow <simon@new-mediacom.com>
Subject: German phone system was "Putting CPAN on a CD: good or not good?"
Message-Id: <645CAC0140CED111AF1500805FEDDB8A4EA2@ns.new-mediacom.co.uk>

I use AOL (booh, hiss) in Germany because my parents' German is not =
good
enough (especially technologically) to deal with a German ISP.

After 9pm call rates are approximatley 1p (1.5c ?) a minute (about
3pfgs) but AOL charges =A32.50 or approx Dm7.50 an hour. On the other
side, certainly in Holland, I couldn't say for sure in Germany, ISDN
charges are very cheap. Dixon's (a chain electrical goods store) in
Holland sell ISDN modems.




> -----Original Message-----
> From:	af06@ma70.rz.uni-karlsruhe.de (Thomas Dehn)
> [SMTP:af06@ma70.rz.uni-karlsruhe.de]
> Posted At:	Thursday, July 16, 1998 12:35 PM
> Posted To:	misc
> Conversation:	Putting CPAN on a CD: good or not good?
> Subject:	Re: Putting CPAN on a CD: good or not good?
>=20
> In article <fl_aggie-1207981425490001@aggie.coaps.fsu.edu>,
> I R A Aggie <fl_aggie@thepentagon.com> wrote:
> >In article <6oa77g$p1a$1@nnrp1.dejanews.com>, =
birgitt@my-dejanews.com
> wrote:
> >
> >+ The attached CD-ROM to the magazin is something done often in
> Germany,
> >+ apparently because online time to download things directly is
> >+ expensive. That is my assumption and I like to be corrected if
> >+ I am wrong.
> >
> >My understanding of the telecom system in Germany is this: you pay
> for
> >every call you make. There's no such thing as "free local calling".
>=20
> Correct. The cheapest available local calls in Germany
> are now 0.061 German marks/90 seconds, i.e. $ 1.35/hour.
> Furthermore most German internet providers still
> charge by the hour (add another $2 or $3 per hour).
>=20
>=20
> Thomas



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

Date: Thu, 16 Jul 1998 12:41:01 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: HELP : Integrating an Access DB with Perl
Message-Id: <linberg-1607981241010001@projdirc.literacy.upenn.edu>

In article <35adfc13.0@news.cranfield.ac.uk>, "Anthony farrow"
<a.n.farrow@cranfield.ac.uk> wrote:

> I need to store information in a database that will be generated
> automatically from a perl script. Now, I could write my own database in Perl
> using files and parsing but I think for this I would really like a third
> party database. And I would prefer access.
> 
> So, has anybody actually done this?

Yep, lots of people have!  If you're using ActiveState Perl, head over to
http://www.activestate.com and grab Dave Roth's Win32::ODBC module.  I
posted some sample code using it a couple months ago, dig around in this
group on deja news and you'll find it.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: 16 Jul 1998 17:08:24 GMT
From: "Bill Catlan" <wcatlan@bccom.com>
Subject: IF statement NOT BROKEN in 5.004!
Message-Id: <01bdb0dc$5b7f3940$7c91ffcc@box-a>

My apologies and thanks to the list.

My original test involved replacing a variable which when printed displayed
 0, with the constant 0.  When the variable was in place, the if statement
failed, but with the constant it worked.  

Now, it works both ways.  I can't fully explain where I went wrong the
first time.

Bill Catlan


Bill Catlan <wcatlan@bccom.com> wrote in article
<01bdb0c6$78a786a0$7c91ffcc@box-a>...
> Does anyone know why:
> 
> $a = 1;
> $b = 0;
> 
> if ($a > $b) {...}
> 
> evaluates false?
> 
> The following also evaluates as false:
> 
> $a = "1";
> $b = "0";
> 
> if ($a gt $b) {...}
> 
> However, the following evaluates as true:
> 
> $a = "1";
> 
> if ($a > 0) {...}
> 
> Bill Catlan
> 
> 


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

Date: Thu, 16 Jul 1998 13:20:20 -0400
From: Christopher Marquis <Christopher.Marquis@fairchildsemi.com>
Subject: Re: Is it possible to create a STAND ALONE EXECUTABLE?
Message-Id: <35AE3654.69DB6DAA@fairchildsemi.com>

If you can get your hands on the Beta Perl 5.05 which has the compiler
build in.

Or if you feel daring try the Perl Compiler Alpha v2 at
ftp://ftp.ox.ac.uk/pub/perl/Compiler-a2.tar.gz ... This will turn it
into C source code and/or compile it.



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

Date: Thu, 16 Jul 1998 17:31:07 GMT
From: ku@my-dejanews.com
Subject: MIME types
Message-Id: <6oldcr$468$1@nnrp1.dejanews.com>

hello-	i'm new at perl programming, and i have a question.  I'm working on
web based software.  I want to set it up so that by clicking on a link the
HTML file will be opened in Excel.  I've heard the way to do this is to set
the MIME type of the HTML file to excel instead of html, and leave the file
exactly as is. I'm wondering if anyone knows the exact syntax to change the
MIME type of a file.

thanks in advance, Arnab

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


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

Date: Thu, 16 Jul 1998 17:43:05 GMT
From: ku@my-dejanews.com
Subject: MIME types
Message-Id: <6ole3c$54j$1@nnrp1.dejanews.com>

sorry if this is a repost, i'm having some server problems.. anyway, i'm
kinda new to perl programming and i'm working on a web based software.	What
I want to do is be able to click on a link that will result in an HTML file
being opened in Excel.	I've been told I can do this by setting the MIME type
of the HTML file to excel instead of text/html.  Does anyone know the exact
syntax to do this? I was not able to find it in the O'Reilly book or at
www.perl.com  Any help would be appreciated.

Thanks in advance, Kumar

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


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

Date: Thu, 16 Jul 1998 17:06:26 GMT
From: hex@voicenet.com (Matt Knecht)
Subject: Re: newbie date format
Message-Id: <mqqr1.144374$on1.7145255@news2.voicenet.com>

F.Quednau <quednauf@nortel.co.uk> wrote:
>F.Quednau wrote:
>> 
>> See man printf
>> 
>Although I have to say that printf and its possibilities should be
>covered in some part of the Perl documentation. Why ?

I don't know... why, do you have to say this? :)

>I think quite a few Perl programmers don't have a C background (Would I
>be the only one? Am I a programmer anyway?)

Who knows... unless you're calling for an informal poll here, I'm from a
C background, so I have printf, auto{increment, decrement}, and all that
fun stuff permenantly tattood into my brain.

But, to address the original question at hand (date formatting) I use a
different method than everybody else chimed in with:

@date = localtime;
$formatted = (++$date[4] < 10 ? '0' . $date[4] : $date[4]) . '/' .
             ($date[5] + 1900);

Which seems pretty longwinded when compared with the sprintf method, but
lets me use another super-fun feature from C, the ?: conditional.

>It seems quite a few people program Perl on a Windows box (Including me,
>but not for long anymore...Linux just came through the mail yesterday :)

Congrats. :)

>Is there a chance we will ever see printf documentation in Perl?
>(Because, frankly, the Perl documentation is far beyond any man page
>that I have seen so far in terms of comprehensiveness :)

_Effective_Perl_Programming_ by "Joseph N. Hall" and "Randal L. Scwartz"
(ISBN 0201419750) addresses this very complaint by devoting an entire
appendix entry to it.  It's also an excellent intermediate book (I'd
almost suggest it before the Camel because of it's tutorial nature).

-- 
Matt Knecht - <hex@voicenet.com>
"496620796F752063616E207265616420746869732C20796F7520686176652066
617220746F6F206D7563682074696D65206F6E20796F75722068616E6473210F"


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

Date: Thu, 16 Jul 1998 17:13:47 GMT
From: pudge@pobox.com (Chris Nandor)
Subject: Re: Please Help Me! (Matt's Script BB Problem)
Message-Id: <pudge-1607981313160001@dynamic186.ply.adelphia.net>

In article <6okb7r$lhh$1@nnrp1.dejanews.com>, Sniper308@qconline.com wrote:

# Tell me, if you guys even go to church, do you put money IN the collection
# plate, or take it out?!!!

It depends.  What kind of church is it?

-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])


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

Date: Thu, 16 Jul 1998 13:06:18 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Problem writing an output file
Message-Id: <linberg-1607981306180001@projdirc.literacy.upenn.edu>

In article <6ol7n2$6mq1@extnews.sunalliance.com>, "Alan Morris"
<amorri1@pop.sunalliance.com> wrote:

> I'm having a problem writing to a file in a specific location and wondered
> if anyone could help.
> 
> I have put a Perl script into the Scripts directory on an NT IIS and am able
> to run it.
> 
> I would like to write to a file called output.txt in the _private directory
> of a subweb I am using.
> 
> The statement
> 
> $output = ">>output.txt";
> 
> writes to the Scripts directory, and nothing I have tried allows me to write
> the file anywhere else. I have tried using a URL and a full disk\directory
> path and . and .. notation.

Hmm.  You're saying ">>C:\\foo\\bar\\baz" doesn't work?  It should.  I
think.  Maybe you should post some examples that fail.
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 16 Jul 1998 13:18:42 -0400
From: Bullwinkle <nospam@cs.umd.edu>
Subject: Re: Q: Changing IP address via perl
Message-Id: <35AE35F2.6CD85D83@cs.umd.edu>

Apologies, this is a Windows '95 laptop, and DHCP is not an option (for the
work network).

Netswitcher does appear to work. My machine did just freeze, but then this
is not uncommon...

Bullwinkle wrote:

> I routinely move my laptop between the ethernet at work and an ethernet
> at home. I've got the changes needed down to just changing the IP
> address and rebooting. However, it's still kludgey.
>
> 1) Is there a perl module that will let me write a script to change the
> machine's IP address?
> 2) Any conceivable way to "restart" just the ip stack, rather than the
> entire machine?
>
> Thanks,
> pete
>
> keleher@cs.umd.edu





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

Date: Thu, 16 Jul 1998 13:56:33 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Regexp to handle \\n\n\n
Message-Id: <comdog-ya02408000R1607981356330001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6okdqi$4vg$1@mathserv.mps.ohio-state.edu>, ilya@math.ohio-state.edu (Ilya Zakharevich) posted:

>[A complimentary Cc of this posting was sent to brian d foy
><comdog@computerdog.com>],
>who wrote in article <comdog-ya02408000R1507981655520001@news.panix.com>:

>>    while( $value =~ s/ ([^\\]) \\ n/$1\n/xg ) { pos($value)-- };
>> 
>> the character for preceding the next two can be compared to the
>> negated character class.  in simpler terms, the regex takes one
>> step backwards before trying the next match.

>What is this /g doing there?

um, it's not doing anything ;)

i started a different way than ended with what i posted.  the  
/g got carried over in the yank and put.  without the /g one gets
the same output.

sorry for the sloppiness.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: 16 Jul 1998 12:30:18 -0500
From: Dave Duchscher <daved@orion.tamu.edu>
Subject: Re: Removing the ^M character
Message-Id: <ue4swhzot1.fsf@orion.tamu.edu>

<mikane@shell3.ba.best.com> writes:

Now that I know that DOS files end in \r\n.  Teach me not to read
carefully.

> I am having trouble removing the ^M character from the end of a line.
> 
> I have tried
> 
> $line=~s/\r\n$//;

These won't work because the '$' matches the end of line before the new
line (\n).

> $line=s/\n$//;

This won't work because of the assigning.  '=' compared to '=~' and the
reason sited above.

> $line=s/\r$//;

This won't work because you are assigning.  '=' compared to '=~'.

> Is there another method?
>
> I want to keep carriage returns within $line and delete the trailing.

This should work. (At least it worked just a second ago.)

   $line =~ s/\r$//

or in a command line style:

  perl -i.bak -ne 's/\r$//' <file>

-- 
Dave Duchscher                       CIS Network Group
Network Specialist                   Texas A&M University


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

Date: Thu, 16 Jul 1998 13:58:40 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Restricting refering domains access to script?
Message-Id: <comdog-ya02408000R1607981358400001@news.panix.com>
Keywords: from just another new york perl hacker

In article <linberg-1607981300330001@projdirc.literacy.upenn.edu>, linberg@literacy.upenn.edu (Steve Linberg) posted:

>In article <6ol1eo$8bc$1@news.iastate.edu>, kortbein@iastate.edu (Josh
>Kortbein) wrote:
>
>> Abigail (abigail@fnx.com) wrote:
>> 
>> : Ob Puzzle: Name 3 cases where there is no sensible REFERER to send
>> :            for a browser.
>> 
>> Offhand, two of them seem to be
>> 
>> 1) when the default home page is loaded
>> 2) when a URL is typed into the "Location" widget
>
>3) When a bookmark is used
>4) When a URL is passed as a parameter to a browser

5) when certain browsers do not clear their REFERER memory after
a change of context.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 16 Jul 1998 14:00:44 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Restricting refering domains access to script?
Message-Id: <comdog-ya02408000R1607981400440001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6ol1eo$8bc$1@news.iastate.edu>, kortbein@iastate.edu (Josh Kortbein) posted:

>Abigail (abigail@fnx.com) wrote:
>: brian d foy (comdog@computerdog.com) wrote on MDCCLXXX September MCMXCIII
>: in <URL: news:comdog-ya02408000R1607980002520001@news.panix.com>:
>: ++ In article <6ojf30$s6$1@camel15.mindspring.com>, "Doug Younger" <cgi-bin@mindspring.com> posted:
>: ++ 
>: ++ >Hello,
>: ++ >$ENV{REMOTE_HOST} is the machine where the end user is sitting at... (or
>: ++ >$ENV{REMOTE_ADDR} for IP address.
>: ++ > If you want where the script was called from (from a web page not on the
>: ++ >same server), which I doubt is the case, but just in case, use:
>: ++ >$ENV{HTTP_REFERER} will need to split out the server portion as it contains
>: ++ >the entire URL.
>: ++ 
>: ++ of course, none of those are reliable due to proxies and broken 
>: ++ browsers.
>
>: Broken? Broken? First of all, a browser isn't sending the IP number
>: (or name) - that can be interfered from the TCP/IP connection.
>
>: As for REFERER, the RFC does not make it a requirement, and
>: in certain cases, browser should not even send a REFERER header.

perhaps 'proxies and browsers' should have been 'proxies or
browsers'.  i never meant for anyone to infer that the browser
was able to tell the server anything about the TCP connection - just
the extra request header stuff.

-- 
brian d foy                                  <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>


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

Date: Thu, 16 Jul 1998 16:45:05 GMT
From: livshits@acm.org
To: mccabe@netscape.com
Subject: Return value of eval()
Message-Id: <6olamh$vqj$1@nnrp1.dejanews.com>

I have an eval statement that can have anything in it (or, for that matter,
an anonymous procedure). I don't know what code will be in it and I'd like
some way to check the return value or the value of the last statement
evaluated. So I try to create a reference to the result of the execution like
this:

  $_ = \eval('return %ENV'); print
and this outputs SCALAR... However,
  $_ = \%ENV; print
works fine and outputs HASH as expected.

Any help will be appreciated.

Please email, thanks,
- Vladimir

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


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

Date: Thu, 16 Jul 1998 13:21:07 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Return value of eval()
Message-Id: <linberg-1607981321070001@projdirc.literacy.upenn.edu>

In article <6olamh$vqj$1@nnrp1.dejanews.com>, livshits@netscape.com wrote:

> I have an eval statement that can have anything in it (or, for that matter,
> an anonymous procedure). I don't know what code will be in it 

Yikes.  This sounds dangerous.  Are you getting the code from a trusted
source before you go ahead and execute it?  What if it contains "`rm
-rf`"?

If security isn't a problem, then ignore that.

> and I'd like
> some way to check the return value or the value of the last statement
> evaluated. So I try to create a reference to the result of the execution like
> this:
> 
>   $_ = \eval('return %ENV'); print
> and this outputs SCALAR... However,
>   $_ = \%ENV; print
> works fine and outputs HASH as expected.

Maybe I don't understand, but is there a reason you don't just take the
value returned by eval?  Why the reference?  Why not just

$foo = eval($trusted_code);
_____________________________________________________________________
Steve Linberg                       National Center on Adult Literacy
Systems Programmer &c.                     University of Pennsylvania
linberg@literacy.upenn.edu              http://www.literacyonline.org


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

Date: Thu, 16 Jul 1998 10:56:24 -0700
From: Jerome O'Neil <joneil@cks.ssd.k12.wa.us>
To: abraham@mpi.com
Subject: Re: use strict
Message-Id: <35AE3EC8.6368BD4C@cks.ssd.k12.wa.us>

abraham@mpi.com wrote:
> 
> In article <6oio53$gbn$1@ocean.cup.hp.com>,
> 
> Change $line to my $line or $main::line and you'll be ok.
> 
> P.S. Why are you using strict if you don't know what it does?

With as much chest beating as goes on here about using strict and -w
(thats a Good Thing, BTW),  I'm surprized it matters.

I would interpret it as:
"I don't quite know what strict does, but everyone says it's good, so
I'll take their word for it, use it, and learn the details later."

Jerome "Strictly Speaking" O'Neil


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

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

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