[9578] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3172 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jul 16 01:07:13 1998

Date: Wed, 15 Jul 98 22:00:43 -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           Wed, 15 Jul 1998     Volume: 8 Number: 3172

Today's topics:
        "uniq -c"-like script (Sweth Chandramouli)
        AWK Interpreter <irisbeau@wolsi.com>
    Re: AWK Interpreter (Andrew M. Langmead)
        Better way of saying this. <domainsource@usa.net>
    Re: Determining the number of the last line that was ex <mpersico@erols.com>
    Re: efficiency: print<<"xxx" vs. print (Mark-Jason Dominus)
    Re: Execution and Replacement Question. (Abigail)
    Re: Extracting URLs from a file (Craig Berry)
    Re: How to tell if a scalar is a number? (Abigail)
    Re: mail bomber source code for perl. (Bob Trieger)
    Re: mail bomber source code for perl. (The Wildman)
    Re: mail bomber source code for perl. (Abigail)
        Need to Hire Perl scripter for new website (David)
        Newbie: standard input/ouput <tdean@gte.net>
    Re: Newbie: standard input/ouput <jsbobcat.nospam@mediaone.net>
    Re: OLE under Win32 <rpsavage@ozemail.com.au>
    Re: pattern matching with an = <rick.delaney@shaw.wave.ca>
    Re: perl IDE and compiler <mpersico@erols.com>
    Re: Perl Setup on NT <tdean@gte.net>
    Re: Perl Setup on NT <tdean@gte.net>
        Problem with interpolation in 'exec' command <bericson@geocities.com>
    Re: RegExps: Check if string consists of EXACTLY 3 digi <mgregory@asc.sps.mot.com>
    Re: RegExps: Check if string consists of EXACTLY 3 digi (brian d foy)
    Re: Removing the ^M character (C. Abney)
    Re: Removing the ^M character (C. Abney)
    Re: Removing the ^M character <daved@orion.tamu.edu>
    Re: Restricting refering domains access to script? <domainsource@usa.net>
    Re: Restricting refering domains access to script? (brian d foy)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Thu, 16 Jul 1998 04:23:26 GMT
From: sweth-usenet@astaroth.nit.gwu.edu (Sweth Chandramouli)
Subject: "uniq -c"-like script
Message-Id: <sweth-usenet-1607980023060001@alex-va-n013c081.moon.jic.com>

   i have a bunch of files that are, in effect, the output of a series of
"uniq -c" commands run on other files: the first two (tab-separated)
columns are data, and the third column is a numerical count of the number
of times that that particular data pair appeared in the other file.  i
need to take these files and come up with an overall count of how many
times each data pair appeared in all of the initial files.  
   for example, for a file like this:

aaa   bbb   3
aaa   bbb   11
bbb   aaa   3
bbb   ddd   5
bbb   ccc   2
bbb   ccc   5
ddd   aaa   5
ddd   bbb   2
ddd   bbb   18

   i need to be able to generate this:

aaa   bbb   14
bbb   aaa   3
bbb   ddd   5
bbb   ccc   7
ddd   aaa   5
ddd   bbb   20

   i have a shell script to do this, but with an input file of a few megs,
it takes hours to process.  any advice on how to do this in perl?

   (actually, the input file in question is, i just realized after looking
at it again, probably just the result of a sed script being run on a
syslog file, to parse out the source and destination IPs and the packet
counts from each line.  i can duplicate this output with the following sed
script:

sed 's/.*p \([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*
\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\).*,
\([0-9]\{1,\}\) packet.*/\1       \2      \3/'

   would it be easier/more efficient to fold this parsing into the perl
script that then does the counting?  if so, how?  (i tried running the sed
script i came up with through s2p, but the resulting perl script would
abort during compilation.))

   tia,
   sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


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

Date: Tue, 14 Jul 1998 05:44:41 -0700
From: "David Reynolds" <irisbeau@wolsi.com>
Subject: AWK Interpreter
Message-Id: <6ojnp0$vt$1@news.wolsi.com>

I am learning Perl and have have programmed a great deal in AWK.  I was
looking for a perl program that converted AWK code to Perl.  I would like to
see the differences between the two.


David




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

Date: Thu, 16 Jul 1998 04:56:16 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: AWK Interpreter
Message-Id: <Ew68Du.2F5@world.std.com>

"David Reynolds" <irisbeau@wolsi.com> writes:

>I am learning Perl and have have programmed a great deal in AWK.  I was
>looking for a perl program that converted AWK code to Perl.  I would like to
>see the differences between the two.

There is in a2p utility included with the perl distribution that turns
(old) awk into perl. It might be useful to figure out the syntactic
differences, but the result of the translation is unlikely to be
idiomatic perl.

(Have you ever heard the expression "You can write Fortran in any
language". Well, awk mechanically translated into perl isn't going to
be very perl-ish.)

-- 
Andrew Langmead


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

Date: Wed, 15 Jul 1998 23:08:49 -0400
From: "David Thompson" <domainsource@usa.net>
Subject: Better way of saying this.
Message-Id: <6ojqkt$6nk$1@winter.news.erols.com>

I have a feeling that I'm carrying C++ to far into Perl here and I'm
missing a good way of doing things.
I have a list of keywords and a string.  I need to see if any of the
keywords are in the string.

Examples (keywords are "joe, bob, mary"):
xxxjoexxx = true
mary = true
xxxxmaryjoe = true
xxx = false
xxxmar = false

Pretty straightforward.  Using my C++ experience I have the following
code, which works, but probably isn't Perl elegant:

----------
$teststring = "something"
$allowed = "";
@allowed = qw (mary joe bob);
foreach $keystring (@allowed)
 {
 if ($teststring =~ /$keystring/i) {$allowed = "yup";}
 }
unless ($allowed eq "yup") {die "Sorry, not found";}
----------

Now, is there an easier way to do that without a foreach?  Thanks much!

David





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

Date: Wed, 15 Jul 1998 22:09:39 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Surendra Pothuru <surendra@asic.sc.ti.com>
Subject: Re: Determining the number of the last line that was executed by eval
Message-Id: <35AD60E3.6C491944@erols.com>

Look at Carp for both the functionaity you want AND code for how it's
done. Carp comes in the Perl distribution.


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

Date: 15 Jul 1998 23:53:57 -0400
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: efficiency: print<<"xxx" vs. print
Message-Id: <6ojtgl$kpj$1@monet.op.net>


In article <6ojjdo$6g5@mozo.cc.purdue.edu>,
Michael J Gebis <gebis@albrecht.ecn.purdue.edu> wrote:
>    Rules of Optimization:
>    Rule 1: Don't do it.
>    Rule 2 (for experts only): Don't do it yet.
>        - M.A. Jackson
>


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

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

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



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

Date: 16 Jul 1998 04:11:48 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Execution and Replacement Question.
Message-Id: <6ojui4$cfv$2@client3.news.psi.net>

Sanjay Joshi (joshi@ee.tamu.edu) wrote on MDCCLXXIX September MCMXCIII in
<URL: news:Pine.SOL.3.96.980715173813.28418G-100000@eesun1.tamu.edu>:
++ Hi,
++ 	I have a set of statements. 
++ 
++ $dates = `date`; 
++ print OUTPUT ("$dates");
++ 
++ How do I compress this to just one line to make it concise?


#!/usr/bin/sh
date > output



Or, in Perl:

print OUTPUT scalar localtime, "\n";



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


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

Date: 16 Jul 1998 04:42:19 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Extracting URLs from a file
Message-Id: <6ok0bb$7j6$1@marina.cinenet.net>

Ronald J Kimball (rjk@coos.dartmouth.edu) wrote:
: Craig Berry <cberry@cinenet.net> wrote:
: 
: >   @urls = $text =~ m!"(http://.*?)"!g
: > 
: > This is prone to a few false positives and negatives (involving such
: > things as commented-out code), but it's good as far as it goes, and has
: > the advantage of simplicity.
: 
: @urls = $text =~ m!"(http://[^"]*)"!g
: 
: is simpler and much more efficient.

More efficient, absolutely.  Simpler for the regex code to deal with,
definitely.  Simpler for human readers?  I don't think so.  As I'm not
sure of what kind of simplicity you're claiming, I don't know whether I
agree with you or not.

: Don't use non-greedy matching when you don't have to.

I would amend this with:  *Do* use non-greedy matching when you don't care
about a (usually small) performance hit, and you wish to express the regex
clearly for ease of maintenance.

Needless to say, it's a matter of taste and particular circumstances.  I
merely wish to suggest there are a multitude of valid positions on this
issue.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      Member of The HTML Writers Guild: http://www.hwg.org/   
       "Every man and every woman is a star."


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

Date: 16 Jul 1998 04:14:04 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How to tell if a scalar is a number?
Message-Id: <6ojumc$cfv$3@client3.news.psi.net>

Paul Tomko (tomko@xnet.com) wrote on MDCCLXXIX September MCMXCIII in
<URL: news:6ojbml$lic$1@flood.xnet.com>:
++ I admit to being a former C programmer. I am trying to determine the
++ easiest way to determine if a scalar contains all digits, or if it
++ compares some non-digit characters ; without of course, printing it out
++ and looking at it.


Even C programmers can learn how to read a FAQ!



Abigail
-- 
FAQ Reading for Dummi^WC Programmers


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

Date: Thu, 16 Jul 1998 01:51:18 GMT
From: sowmaster@juicepigs.com (Bob Trieger)
Subject: Re: mail bomber source code for perl.
Message-Id: <6ojmf4$e9b$1@strato.ultra.net>

Matthew Flinchbaugh <matthew@nofear.hjsoft.com> wrote:
-> hey does any one have the perl source code for a mail bomber?
-> for Linux
-> ?

troll of the month award?

Bob Trieger
sowmaster@juicepigs.com
" Cost a spammer some cash: Call 1-800-400-1972 
  Ext: 1949 and let the jerk that answers know 
  that his toll free number was sent as spam. "


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

Date: 16 Jul 1998 01:53:48 GMT
From: the_wildman_98@hotmail.com (The Wildman)
Subject: Re: mail bomber source code for perl.
Message-Id: <slrn6qqo61.hi.the_wildman_98@foobar.net>

On 15 Jul 1998 23:29:45 GMT, Wildman's eyes rolled up in his head and
froth dripped from his fangs when Matthew Flinchbaugh
<matthew@nofear.hjsoft.com> said the following fighting words:
>hey does any one have the perl source code for a mail bomber?
Honor the followup header and repeat the question, and I'm sure somebody will
let you have it.

>r does anyone know of any pages that have the perl or c sources to Linux
>games?
Two points:
1. The vast majority of Linux software is under the GNU GPL or an equivalent
free software license - meaning you can get the source just by asking for it
2. The vast majority of Linux software are not games, and I haven't yet seen
a game in perl.

-- 
The Wildman
PLEASE do NOT reply to this post! If you MUST email me, please use wildman at
microserve dot net, but a followup is preferred. If you DO reply to the
wrong address, I'll still read it but don't expect a reply. Unless you are a
spammer, in which case I will reply to your ISP.
Fight spam - http://www.cauce.org/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCS/MU d- s: a- C++ UL+ P+ L+++ !E W-- N+++ o !K w--- !O !M V-- PS PE Y+ PGP?
t+ 5+ X R tv b++ DI+ D++ G e h---- r++++ y++++
------END GEEK CODE BLOCK------


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

Date: 16 Jul 1998 04:17:40 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: mail bomber source code for perl.
Message-Id: <6ojut4$cfv$4@client3.news.psi.net>

Matthew Flinchbaugh (matthew@nofear.hjsoft.com) wrote on MDCCLXXIX
September MCMXCIII in <URL: news:6oje19$hkh$1@butterfly.hjsoft.com>:
++ hey does any one have the perl source code for a mail bomber?
++ for Linux

Yes.

No, that's one piece of code you *can't* have.

++ r does anyone know of any pages that have the perl or c sources to Linux
++ games?

The computer is the game.



Abigail
-- 
perl -wle '$, = " "; sub AUTOLOAD {($AUTOLOAD =~ /::(.*)/) [0];}
           print+Just (), another (), Perl (), Hacker ();'


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

Date: Wed, 15 Jul 1998 22:48:34 -0500
From: wndrinNOSPAM@magicnet.net (David)
Subject: Need to Hire Perl scripter for new website
Message-Id: <9701D53A7327681B.83D3091C76128C3D.31FDF00137A9B22F@library-proxy.airnews.net>

Hello,

I am in the process of opening a new internet business and need a
competent programmer to modify the generic scripts and create or modify
some new ones.

Please email me at wndrin@magicnet.net and we can discuss the project.

We are based in central Florida.

Thank you in advance.

Sincerely,

David Douglass
Sweepies.com

-- 
Please remove the obvious to respond by email.  Darn spammers!


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

Date: Wed, 15 Jul 1998 22:34:14 -0400
From: "tdean" <tdean@gte.net>
Subject: Newbie: standard input/ouput
Message-Id: <6ojp1l$797$1@news-2.news.gte.net>

I have gotten to the point with perl where I can create and run perl scripts
and see the output in the dos box using print statements. How do I now
redirect that output to a text file? A small example would be helpful. Any
info will be appreciated. TIA

--
ICQ 7305805
replace at with @ and dot with .




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

Date: Thu, 16 Jul 1998 00:53:30 -0400
From: eliminate nospam from mail address <jsbobcat.nospam@mediaone.net>
To: tdean <tdean@gte.net>
Subject: Re: Newbie: standard input/ouput
Message-Id: <35AD8749.D2177F02@mediaone.net>

You can do that with a simple redirect of output.
> txt.txt - means write to output file
>> txt.txt - means append to output file
As you requested here is a sample:

Here is the script.
C:\>type test.pl
{
$a = "lower A";
print $a;
$A = "Upper A";
print "\nThis is upper: ";
print $A;
print "\nThis is Lower: ";
print $a;
}

Here is the execution:

C:\>perl test.pl >test.bob

Here is the output file created.
C:\>type test.bob
lower A
This is upper: Upper A
This is Lower: lower A




tdean wrote:

> I have gotten to the point with perl where I can create and run perl scripts
> and see the output in the dos box using print statements. How do I now
> redirect that output to a text file? A small example would be helpful. Any
> info will be appreciated. TIA
>
> --
> ICQ 7305805
> replace at with @ and dot with .





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

Date: 16 Jul 1998 04:32:40 GMT
From: "Ron Savage" <rpsavage@ozemail.com.au>
Subject: Re: OLE under Win32
Message-Id: <01bdb074$c10ea7e0$43ea1286@steelres-pcm657.resmel.bhp.com.au>

See The Perl Journal, Issue #10 (Vol 3, No. 2), p 39 for a l-o-n-g
explanation.

John M. Dlugosz <john@dlugosz.com> wrote in article
<DFBBEDD57603115A.5C01E31FAE11D7AA.AE1CCD270BEB3173@library-proxy.airnews.ne
t>...
> Has anybody figured out some proper instructions for using OLE in
> ActiveWare's "official" Win32 Perl?  Here's what I've figured out thus
[snip]


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

Date: Thu, 16 Jul 1998 02:25:43 GMT
From: Rick Delaney <rick.delaney@shaw.wave.ca>
Subject: Re: pattern matching with an =
Message-Id: <35AD6608.F46FFAC3@shaw.wave.ca>

Juli@my-dejanews.com wrote:
> 
> Can you do pattern matching with an equal sign?  (=)
> Like $found =~ /=/;
> I know you can do pattern matching with characters, abc...
> and numbers 123, and things such as $, but I couldn't find anything
> about matching = .  Any help is appreciated.
> 

You can match on any character; that's what makes it so cool.  See the
perlre page for which characters are special (metacharacters like $) and
how to deal with them.

BTW, it's pretty hard to blow up the world by testing perl code.  If
you're not sure if perl can do something, try it out.

$found = 'x = 10';
print "Oh, yeah!\n" if $found =~ /=/;

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


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

Date: Wed, 15 Jul 1998 22:26:57 -0400
From: "Matthew O. Persico" <mpersico@erols.com>
To: Martien Verbruggen <mgjv@comdyn.com.au>
Subject: Re: perl IDE and compiler
Message-Id: <35AD64F1.93F7617F@erols.com>

Whoops!

Xeamcs meant as answer to IDE not compiler.

I have to stop usenet'ting so late.

Martien Verbruggen wrote:
> 
> In article <35AAC438.1FE3A2E7@erols.com>,
>         "Matthew O. Persico" <mpersico@erols.com> writes:
> > stlam@yahoo.com wrote:
> >
> >> Is there any Perl compiler for win32/unix?
> >
> > Xemacs
> 
> Since when is emacs a compiler?
> 
> The correct answer of course is: perl.
> 
> Go to http://www.perl.com/latest.html and look around there.
> 
> Martien
> --
> Martien Verbruggen                  |
> Webmaster www.tradingpost.com.au    | The number of the beast is not 666. The
> Commercial Dynamics Pty. Ltd.       | number is 95, and it's awake.
> NSW, Australia                      |


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

Date: Wed, 15 Jul 1998 22:28:07 -0400
From: "tdean" <tdean@gte.net>
Subject: Re: Perl Setup on NT
Message-Id: <6ojom9$hor$1@news-2.news.gte.net>

nolan:
within the registry .pl is associated with perl.exe but if you go into
ntexplorer\view\options\file types you will not seen any .pl file type or
association.
but when i create a .pl file it is assigned a perl icon . so the association
is there in some way. How about if I create a Perl system environment
variable, called PERL and assign it the value of C:\Perl;C:Perl\bin and then
concatenate the perl variable to the system path at the end like: %PERL% .
I'm using NT40SP3.
any help or info will be appreciated. TIA

--
ICQ 7305805
replace at with @ and dot with .
Nolan B wrote in message ...
>You need to associate .pl files with the c:\perl\bin\perl.exe
>Steve Linberg wrote in message ...
>>In article <6oiop5$7cm$1@news-1.news.gte.net>, "tdean" <tdeanatgtedotnet>
>wrote:
>>
>>So perl c:\perl\bin\perlscript.pl doesn't work?
>>
>>
>>> perlscript.pl is in c:\perl\bin
>>>
>>> --
>>> ICQ 7305805
>>> replace at with @ and dot with .
>>> Steve Linberg wrote in message ...
>>> >In article <6ogu63$nje$1@news-2.news.gte.net>, "tdean"
><tdeanatgtedotnet>
>>> wrote:
>>> >
>>> >> I want to execute my perl scripts from within the Dos box on NT4SP3
>from
>>> C:\
>>> >> I have added the following to the path environment variable:
>>> >> C:\;C:\Perl\bin and rebooted the machine to take effect
>>> >> when I then open a NT Dos box which defaults to c:\ and I try to
>execute
>>> a
>>> >> perl script:
>>> >> perl perlscript.pl  I get the following msg:
>>> >> "can't open perl script perlscript.pl. No such file or directory"
>>> >> guys, whats the fix for this?
>>> >
>>> >where is perlscript.pl?
>>> >_____________________________________________________________________
>>> >Steve Linberg                       National Center on Adult Literacy
>>> >Systems Programmer &c.                     University of Pennsylvania
>>> >linberg@literacy.upenn.edu              http://www.literacyonline.org
>>_____________________________________________________________________
>>Steve Linberg                       National Center on Adult Literacy
>>Systems Programmer &c.                     University of Pennsylvania
>>linberg@literacy.upenn.edu              http://www.literacyonline.org
>
>




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

Date: Wed, 15 Jul 1998 22:30:55 -0400
From: "tdean" <tdean@gte.net>
Subject: Re: Perl Setup on NT
Message-Id: <6ojorc$9be$1@news-2.news.gte.net>

steve :
If I am at the C:\ and type in perl c:\perl\bin\perlscript.pl, yes it works
what I want is to be at the c:\ and type perl perlscript.pl
sure I can cd\perl\bin and type perl perlscript.pl and that works, but I
thought by having c:\Perl;C;\perl\bin on the end of the path it would be
able to find it.Perhaps the c:\perl;c:\perl\bin should be at the beginning
of the path?

--
ICQ 7305805
replace at with @ and dot with .
Steve Linberg wrote in message ...
>In article <6oiop5$7cm$1@news-1.news.gte.net>, "tdean" <tdeanatgtedotnet>
wrote:
>
>So perl c:\perl\bin\perlscript.pl doesn't work?
>
>
>> perlscript.pl is in c:\perl\bin
>>
>> --
>> ICQ 7305805
>> replace at with @ and dot with .
>> Steve Linberg wrote in message ...
>> >In article <6ogu63$nje$1@news-2.news.gte.net>, "tdean"
<tdeanatgtedotnet>
>> wrote:
>> >
>> >> I want to execute my perl scripts from within the Dos box on NT4SP3
from
>> C:\
>> >> I have added the following to the path environment variable:
>> >> C:\;C:\Perl\bin and rebooted the machine to take effect
>> >> when I then open a NT Dos box which defaults to c:\ and I try to
execute
>> a
>> >> perl script:
>> >> perl perlscript.pl  I get the following msg:
>> >> "can't open perl script perlscript.pl. No such file or directory"
>> >> guys, whats the fix for this?
>> >
>> >where is perlscript.pl?
>> >_____________________________________________________________________
>> >Steve Linberg                       National Center on Adult Literacy
>> >Systems Programmer &c.                     University of Pennsylvania
>> >linberg@literacy.upenn.edu              http://www.literacyonline.org
>_____________________________________________________________________
>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 03:54:22 +0000
From: Bryan Ericson <bericson@geocities.com>
Subject: Problem with interpolation in 'exec' command
Message-Id: <35AD796D.27596F2E@geocities.com>

Hello all

I seem to be having a strange problem with Perl's 'exec' command.  I'm
trying
to set up a script that executes an rxvt (in Linux) with a randomly
chosen pixmap
for the background.  The problem is, the 'exec' command doesn't behave
the way
it should when when there are variables to be interpolated.  Here's what
I have:

# ... $tile_dir is the directory containing the pixmaps ...
# ... fill @pix with the .xpm filenames ...
# ... $r is a random number between 0 and $#pix ...
exec "rxvt -pixmap \"$pixmap_dir/$pix[$r];0x0\"";

(Note that the -pixmap switch needs the literal quotes so that the shell

interpreter doesn't think that the semicolon is a new command instead of
a
geometry setting)

This will start an rxvt with the message:

rxvt: couldn't load XPM file "/home/bry/AfterStep/bkimage/tiled/4.xpm"
(where 4.xpm is the randomly chosen pixmap)

However, when I change the script to reflect an actual file name, as in:

exec "rxvt -pixmap \"$pixmap_dir/4.xpm;0x0\"";

then the rxvt starts with the proper image in the background, as
expected.
Note that I can use the $pixmap_dir variable without any problems.

Is there something I've missed here?  I'm using Perl 5.004 in Redhat
Linux 5.0
(2.0.32 kernel).  If anyone can tell me what I'm doing wrong, I'd
appreciate it.

TIA,

Bry
bericson@geocities.com




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

Date: 16 Jul 1998 11:22:15 +0930
From: Martin Gregory <mgregory@asc.sps.mot.com>
Subject: Re: RegExps: Check if string consists of EXACTLY 3 digits ??
Message-Id: <r8vhoymuk0.fsf@asc.sps.mot.com>

comdog@computerdog.com (brian d foy) writes:

> In article <r83ec4o8x3.fsf@asc.sps.mot.com>, Martin Gregory <mgregory@asc.sps.mot.com> posted:
> 
> >What do you think that this will print (guess before running!)?
> >
> >  perl -w -e '$a = "zaped\n"; $a =~ s/[a-z]*?(.)$/$1/; print length($a);'
> >
> >Can you explain the result?
> 
> the result is 2.  the dot does not match newlines unless you use
> the /s modifier.  the dot matches the d, which is replaced by itself,
> and the newline is left as is, leaving a string of length 2.
> 
> :)

Yeah - that's funny!  You are obviously the regex guru - the rest of
us are wallowing in our misconceptions!  So

 perl -w -e '$a = "zaped\n"; $a =~ s/[a-z]*?(.)$/$1/s; print length($a);

also gives length two, and I guess illustrates my point better!  (The
explanation Larry gave earlier applies to this version, I think!)

Martin.


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

Date: Thu, 16 Jul 1998 00:01:15 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: RegExps: Check if string consists of EXACTLY 3 digits ??
Message-Id: <comdog-ya02408000R1607980001150001@news.panix.com>
Keywords: from just another new york perl hacker

In article <r8vhoymuk0.fsf@asc.sps.mot.com>, Martin Gregory <mgregory@asc.sps.mot.com> posted:

>comdog@computerdog.com (brian d foy) writes:
>
>> In article <r83ec4o8x3.fsf@asc.sps.mot.com>, Martin Gregory <mgregory@asc.sps.mot.com> posted:
>> 
>> >What do you think that this will print (guess before running!)?
>> >
>> >  perl -w -e '$a = "zaped\n"; $a =~ s/[a-z]*?(.)$/$1/; print length($a);'
>> >
>> >Can you explain the result?
>> 
>> the result is 2.  the dot does not match newlines unless you use
>> the /s modifier.  the dot matches the d, which is replaced by itself,
>> and the newline is left as is, leaving a string of length 2.
>> 
>> :)
>
>Yeah - that's funny!  You are obviously the regex guru - the rest of
>us are wallowing in our misconceptions!  So

i think that's facetious, as it should be, but you forgot the smiley :)

> perl -w -e '$a = "zaped\n"; $a =~ s/[a-z]*?(.)$/$1/s; print length($a);
>

after thinking about this, i wonder if this is a bug.  the $ assertion
is documented to match at the "end of the string" or "before the
newline".  it seems that the actual behaviour is "before any
new line if there is one" since the "end of string" certainly
doesn't make sense here.

the /s modifier allows the . to match newlines and documents
no exception for the end of the string assertion.  if it can
really match any character, as documented, why can't you
match the very last character with it.

>also gives length two, and I guess illustrates my point better!  (The
>explanation Larry gave earlier applies to this version, I think!)

Larry's right, but i'm dubious that perl should be acting like 
that.

-- 
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: 15 Jul 1998 21:37:05 GMT
From: cabneySP4M@SP4M.SP4Mcyberpass.net (C. Abney)
Subject: Re: Removing the ^M character
Message-Id: <6oj7e1$9oh$1@news.infonex.net>

I'm no expert, but:

==================
#!/usr/bin/perl
# Hopefully this removes that stupid ^M return char from 
# DOS generated ASCII text files.
# Very basic, it takes stdin, passes to stdout
while (<>) {
    s/^M/\n/g;
    print;
}
print "\n";
==================

worked great for me.  The last print is important.
Evidently you don't have to be on a newline to signal EOF in DOS.

In article <6o3g8i$349$1@nntp1.ba.best.com>,
	<mikane@shell3.ba.best.com> writes:

> s/\cM// did not work neither did s/\r\n/\n/gm.

> The ^M character was not generated by a bin ftp, rather by Netscape 3.0 posting
> text from a textarea box.

-C
--
All your qualifications for kookiness seem to be aimed at eliminating
yourself simply because you advocate a mainstream product.  That is sort
of just being a kook who is a conformist.  A bit of a contradiction in
terms, but a valid description. -Bob O                        C. Abney



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

Date: 15 Jul 1998 21:41:16 GMT
From: cabney@rodentia.cyberpass.net (C. Abney)
Subject: Re: Removing the ^M character
Message-Id: <6oj7ls$9oh$2@news.infonex.net>

S**t!

Posting again, because that ^M in the script is done (using vi on Linux)
by typing [Ctrl]-V[Ctrl]-M in insert mode.  I can't remember what the
escaped octal code is, and don't have a table of ascii codes handy.

Sorry about any confusion.

In article <6o3g8i$349$1@nntp1.ba.best.com>,
	<mikane@shell3.ba.best.com> writes:

> s/\cM// did not work neither did s/\r\n/\n/gm.


--
All your qualifications for kookiness seem to be aimed at eliminating
yourself simply because you advocate a mainstream product.  That is sort
of just being a kook who is a conformist.  A bit of a contradiction in
terms, but a valid description. -Bob O                        C. Abney



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

Date: 15 Jul 1998 21:52:31 -0500
From: Dave Duchscher <daved@orion.tamu.edu>
Subject: Re: Removing the ^M character
Message-Id: <ue67gyzevk.fsf@orion.tamu.edu>

cabney@rodentia.cyberpass.net (C. Abney) writes:

> Posting again, because that ^M in the script is done (using vi on Linux)
> by typing [Ctrl]-V[Ctrl]-M in insert mode.  I can't remember what the
> escaped octal code is, and don't have a table of ascii codes handy.

Correct me if I am wrong, but \r is ^M (CR) (perlre).

> In article <6o3g8i$349$1@nntp1.ba.best.com>,
> 	<mikane@shell3.ba.best.com> writes:
> 
> > s/\cM// did not work neither did s/\r\n/\n/gm.

Not a DOS expert, but don't DOS files end in ^M (CR) not ^M^J (CR LF)
so the first removes all line termination and the second never
matches.

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


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

Date: Wed, 15 Jul 1998 22:13:22 -0400
From: "David Thompson" <domainsource@usa.net>
Subject: Re: Restricting refering domains access to script?
Message-Id: <6ojnd4$7hb$1@winter.news.erols.com>

That's what I was looking for ($ENV{HTTP_REFERRER}).  It's a rather
useful script and the logs are showing some accesses outside my domain
:)...

Thanks a lot Doug.

David

Doug Younger wrote in message <6ojf30$s6$1@camel15.mindspring.com>...
>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.
>
>-Doug
>
>David Thompson wrote in message <6ojcf2$dlv$1@winter.news.erols.com>...
>>Is $domain automatically the referring domain of a form submission?
>>
>>I know how to deal with it once I find out that the script is being
run
>>from another domain (kindly point them to my site), but is that the
>>correct way to find out if the form is submitted in a certain domain?
>>
>>Thanks.
>>
>>David
>>
>>
>>brian d foy wrote in message ...
>>>In article <6ojb4t$64l$1@winter.news.erols.com>, "David Thompson"
>><domainsource@usa.net> posted:
>>>
>>>>In a Unix perl script I want to (inside the script, not in the
server
>>>>config) restrict the referring domains that can access a script.  Is
>>>>that possible?
>>>
>>>   die if exists $killed_domains{$domain};
>>>
>>>or you can be less drastic, but that's the idea.
>>>
>>>good luck ;)
>>>
>>>--
>
>
>




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

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

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.

HTTP_REFERER is easily spoofed, as well - just use LWP ;)

-- 
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: 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 3172
**************************************

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