[8576] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2193 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 27 09:17:53 1998

Date: Fri, 27 Mar 98 06:01:08 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Fri, 27 Mar 1998     Volume: 8 Number: 2193

Today's topics:
        ANNOUNCE: Math::MagicSquare 1.20 module <pivari@geocities.com>
    Re: Command line arguments <ewinter@pop3.stx.com>
    Re: Copy file command. <tchrist@mox.perl.com>
    Re: Copy file command. (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: Copy file command. (Jason Gloudon)
    Re: find command equivalent in Perl (John Erjavec V)
    Re: Forced log out after a defined total time, how? (David Lane)
    Re: help needed with grep type function for perl script <ewinter@pop3.stx.com>
        Macperl tchurch@gmu.edu
        Need expl.&help! :) <belle@iki.rssi.ru>
    Re: Need expl.&help! :) <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Perl 5: Win32 vs UNIX (HELP) (Steven Savage)
        Perl server/Java client <nospam@nospam.com>
    Re: Perl server/Java client <zkessin@shell1.tiac.net>
    Re: Please Help, Win95/NT4.0 Serial Port Usage Question (J. Daniel Melton)
        print crypt($password,$Salt); not working <tony@cyberscape.net>
    Re: print crypt($password,$Salt); not working <dboorstein@shopcfn.com>
    Re: PROPOSAL: The Perl Dictionary (User)
    Re: proposal: while $line (<FILE>) (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
    Re: proposal: while $line (<FILE>) (Mike Stok)
        Redirect URL <yellow*@cix.co.uk>
    Re: regular expression audttjk@dbs.com.sg
    Re: S.O.S Necesito Adobe Page Maker Versisn 3.0 para Wi <webmaster@madweb.net>
    Re: Searching for Larry Wall's humor and a Win32 file q (Jeffrey R. Drumm)
    Re: Someone put my munged e-mail address on a spam list <tchrist@mox.perl.com>
    Re: Still a novice (getting older) still needing RegExp (brian d foy)
    Re: trivial example reveals a taint problem? <tchrist@mox.perl.com>
    Re: Use CPAN with Windows 95's DOS prompt? <mfolse@dlprinting.com>
    Re: verifying email address -- how? <tchrist@mox.perl.com>
    Re: Where can I learn about linking C library with Perl (Stefaan A. Eeckels)
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Fri, 27 Mar 1998 12:06:02 +0000
From: Fabrizio Pivari <pivari@geocities.com>
Subject: ANNOUNCE: Math::MagicSquare 1.20 module
Message-Id: <351B962A.1422E2AF@geocities.com>

What is Math::MagicSquare module?
The first purpose of this PERL module is to help you to check your
Square, to answer these questions
Is it a Semimagic Square?
Is it a Magic Square?

The second purpose of this PERL module is to help you to print your
Square.
At the moment the available methods are 'print' that prints the square
on
STDOUT and printhtml that prints the square in HTML format.
I'd like to add
- pringif     (to print the square in a GIF image)
- prinpdf   (to print the square in PDF format)

What is a Magic Square?
Do you like Magic Square?
Do you want to know more information about Magic Square?
Try to visit

A very good introduction on Magic Square
http://www.astro.virginia.edu/~eww6n/math/MagicSquare.html

A whole collection of links and documents in Internet
http://www.pse.che.tohoku.ac.jp/~msuzuki/MagicSquare.html

A good collection of strange Magic Square
http://www.geocities.com/CapeCanaveral/Lab/3469/examples.html

The only Magic Square checker and gif maker in Internet (I think)
http://www.geocities.com/CapeCanaveral/Lab/3469/squaremaker.html

What's new with version 1.20
Added printhtml method

Where can I find it?
http://www.geocities.com/CapeCanaveral/Lab/3469/Math-MagicSquare.html
is the primary location
You also can find it at CPAN archive

Enjoy it!

Send me your suggestions.



--
Fabrizio Pivari
mailto:pivari@geocities.com
http://www.geocities.com/CapeCanaveral/Lab/3469/
Member of ANFACE Software
http://www.geocities.com/CapeCanaveral/Hangar/4794/





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

Date: Fri, 27 Mar 1998 07:09:18 -0500
From: "Eric Winter" <ewinter@pop3.stx.com>
Subject: Re: Command line arguments
Message-Id: <6fg4uj$304@post.gsfc.nasa.gov>

Use the @ARGV array; it contains the command line.
Tony Christian Svderudd wrote in message <6ffgor$77k$1@verkko.uwasa.fi>...
>I'm trying to do a program that modifies html-files.
>How do I pass the command line arguments to program as variables?
>F.ex. 'program tony.html' should process the tony.html and
>'program *' should process all html-files in directory.





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

Date: 27 Mar 1998 11:10:00 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Copy file command.
Message-Id: <6fg1e8$koc$2@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
:Calling system() is bad for two, well, three or four, reasons.

Don't be silly.  Perl is a glue language.  Glue together other programs.
Don't reinvent the wheel.  The Unix tool-and-filter code-reuse philosophy
should not be ignored.  And I bet that your system's cp command is much
better optimized then some hacked together module found in a gutter
somewhere.

Plus at least cp -- or the sysread/syswrite code I posted -- will tell you
which of the files would give an error.  Silly icky File::Copy doesn't even
do that.  Not knowing the source of the problem should one occur is really
extremely programmer-hostile.  

--tom
-- 
	Tom Christiansen	tchrist@jhereg.perl.com


There's going to be no serious problem after this.  --Ken Thompson


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

Date: Fri, 27 Mar 1998 14:56:53 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: Copy file command.
Message-Id: <lassehp-2703981456530001@ra.imv.aau.dk>

In article <6fg1e8$koc$2@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:

> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, Jarkko Hietaniemi <jhi@alpha.hut.fi> writes:
>:Calling system() is bad for two, well, three or four, reasons.
>
>Don't be silly.  Perl is a glue language.  Glue together other programs.
>Don't reinvent the wheel.  The Unix tool-and-filter code-reuse philosophy
>should not be ignored.  And I bet that your system's cp command is much
>better optimized then some hacked together module found in a gutter
>somewhere.

I don't know where _you_ find File::Copy, but I found it in my original
perl5.004_04 source tree, so I tend to think it came with the
latest.tar.gz distribution which I got from a CPAN mirror. Which part of
this chain do you refer to as "gutter"?

>Plus at least cp -- or the sysread/syswrite code I posted -- will tell you
>which of the files would give an error.  Silly icky File::Copy doesn't even
>do that.

Will silly icky File::Copy be removed from the perl distribution or maybe
even fixed?

And if it is that bad, why has it gone into the perl distribution in the
first place?

Have I been wrong in assuming that modules bundled with the distribution
can be considered "standard" in some way?

No flame, just wondering...

BTW, the system() solution doesn't work with MacPerl for example. You may
not care about that, but I'm sure others do. I do.

-Lasse


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

Date: Fri, 27 Mar 1998 13:45:34 GMT
From: jgloudon@manitoba.bbn.com (Jason Gloudon)
Subject: Re: Copy file command.
Message-Id: <slrn6hnb9a.23a.jgloudon@manitoba.bbn.com>

Tom Christiansen <tchrist@mox.perl.com> wrote:
> [courtesy cc of this posting sent to cited author via email]
 .
 .
>Plus at least cp -- or the sysread/syswrite code I posted -- will tell you
>which of the files would give an error.  Silly icky File::Copy doesn't even
>do that.  Not knowing the source of the problem should one occur is really
>extremely programmer-hostile.  

Again, instead of rehashing the deficiencies of the module we should ask
the module author to fix the module.

-- 
Jason Gloudon


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

Date: 26 Mar 1998 21:22:34 GMT
From: jev@pconline.com (John Erjavec V)
Subject: Re: find command equivalent in Perl
Message-Id: <6feguq$796$1@bell.pconline.com>

[posted and mailed]
sadri@macsch.com wrote:
: Is there a nice and easy way of doing this without writing lines of code to do
: this task? I have a Korn Shell script that does that and I 'd like to do thee
: samething with Perl. I use something like this in Korn Shell:
: 
: find ./ -type d -a -mtime +5 -print | sort -u -r
One thing you can try would be to run the find command listed above through
the find2perl script.  That will convert the find command into a perl
script for you, and you can tweak the script created (if needed) after
that.  I did that once, with an approximate command, and it worked out very
well.  I am not entirely sure if this would work under NT, but I really
don't see why not.

-JEV
-- 
John Erjavec V	PGP fingerprint:
jev@pconline.com	7593 1B5A AE11 C0FE BA09  EB5E 8DE9 D2E5 BF5B 87AD
http://www.pconline.com/~jev/index.html


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

Date: 27 Mar 98 12:28:05 GMT
From: dlane@miranda.lpdev.prtdev.lexmark.com (David Lane)
Subject: Re: Forced log out after a defined total time, how?
Message-Id: <351b9b55.0@usenet.lexmark.com>

>So most of the propositions are good if all users use just one 
>computer (clobberd, accounting).
>clobberd seems to be a very good choice, 
>if it would centralize its statistics in one file 
>(which could then be NFS-mounted -> flock, etc.).

Clobberd is a good tool, but you might also consider ACUA. I believe it supports
centralized statistics.

==========================================================
David Lane                           Lexmark International
606-232-2141                         office 6J4/035-2


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

Date: Fri, 27 Mar 1998 07:12:50 -0500
From: "Eric Winter" <ewinter@pop3.stx.com>
Subject: Re: help needed with grep type function for perl script.
Message-Id: <6fg557$308@post.gsfc.nasa.gov>

$str = "128\.0\.0\.2";
open(FILE, $filename);
while (<FILE>) {
    if (/$str/) {
        print;
    }
}
close(FILE);

You can easily modify this to be a sub if that's what you need.

hth
Eric

Mark Kucera wrote in message <35122f3d.13665389@news.mindspring.com>...
>I would appreciate some help from some perl experts out there if
>possible.
>
>Basically i have a file, or records that contains various information.
>i want to be able to search that file for a particular set of data,
>and if found in the file, return the line found  or if not found,
>return that the text was not in the file.
>
>
>example  say i have a data file that contains ip information in the
>form
>
>room::ip::eth address::nslookup::id
>
>204::127.0.0.1:e399800000000s:host@school.edu::1
>205::128.0.0.2:fe90902340000d:host2@school2.edu::2
>...
>...
>...
>
>etc  and i want search this ex file for 128.0.0.2  if 128.0.0.2 is in
>the file, then i want all the other informaiton that is on that line,
>but other wise  i want to know that 128.0.0.2 is not in this file...
>
>
>can someone give me some suggestions about how to do this particular
>task?
>
>
>thanks for your help.
>mark kucera
>kucera@mindspring.com




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

Date: Fri, 27 Mar 1998 07:24:37 -0600
From: tchurch@gmu.edu
Subject: Macperl
Message-Id: <6fg961$p0a$1@nnrp1.dejanews.com>

I am new to Mac developement and have two problems in my first attempt.  I am
trying to make a stand-alone app and have two discrepencies.

    1.  The script works fine on my machine, but when I port it I get error
        messages that tell me perl cannot find Macperl::DoApplescript.  The
        applescript is to open the select file window when the user double-
        clicks on the app.  The drag and drop part works just fine.

    2.  Whenever the script exits, it leaves an instance of Macperl running
        under the finder(? top left corner list on the Mac).  I would like
        the application to shut down completely and not have this instance
        running.  Is this possible?

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


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

Date: Fri, 27 Mar 1998 16:34:11 +0300
From: "Belle" <belle@iki.rssi.ru>
Subject: Need expl.&help! :)
Message-Id: <6fg6a5$3h8$1@zware.space.ru>

Howdy!
How  i get  string length, like a Pascal function : Length(S :String) :
integer ...??

Thanx! :)






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

Date: 27 Mar 1998 14:39:59 +0100
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Need expl.&help! :)
Message-Id: <7xlntw9rrk.fsf@beavis.vcpc.univie.ac.at>

Re: Need expl.&help! :), Belle <belle@iki.rssi.ru> said:

Belle> Howdy!  How i get string length, like a Pascal
Belle> function : Length(S :String) : integer ...??

Hmm, could it be the function (drum roll)   `length'  ???

Yes! :-)

perldoc -f length


-- 
Tony Curtis, Systems Manager, VCPC,      | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien, AT | http://www.vcpc.univie.ac.at/

"Everything I am, I learned on the back of cereal boxes" ~ RJ, "Over the Hedge"


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

Date: 27 Mar 1998 13:27:25 GMT
From: badger@infinet.com (Steven Savage)
Subject: Perl 5: Win32 vs UNIX (HELP)
Message-Id: <6fg9ft$8vq@news1.infinet.com>


I am trying to set up a search script originally meant for unix on a 
Win32 box using Perl5 and am having a devil of a timegetting directories, 
etc. correct.  Anyone familiar with Win32/Unix issues on Perl, please let 
me know.

--
BADGER
------------------------------------------------------------------
Badger's Gate:
http://www.infinet.com/~badger
Boldly stating a working knowledge of HTML since 1995

MEMBER OF:
Association of Internet Professionals: http://www.association.org/
------------------------------------------------------------------


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

Date: Fri, 27 Mar 1998 20:17:09 +0800
From: nospam <nospam@nospam.com>
Subject: Perl server/Java client
Message-Id: <351B98C5.6A73@nospam.com>

FROM JEAN-YVES SIREAU   Email :  jys@
hk.super.net
_____________________________________

I'm trying to get a Perl script to send a message to a Java applet.  Can
someone give me some help debugging it ?

Here is my code :

#########PERL SERVER SCRIPT
#!/usr/bin/perl5

eval {

  $host=$ENV{"REMOTE_HOST"};
  $addr=$ENV{"REMOTE_ADDR"};

  print "Content-type: text/html\n\n";
  print "Your're at $host and $addr<P>";

  $url = "http://$addr";
  $content = "Is this posting ??";

  ($url =~ m#^http://([^/:]+)(:\d+)?(.*)#) || die "Invalid URL $url";
  $hostname = $1;
  $port = 1234;
  $partial_url = $3;
  $tries = 0;

  while (1) {
    ($d1, $d2, $prototype) = getprotobyname("tcp");
    socket(SOCKET, 2, 1, $prototype) || die 'No socket';
    ($d1, $d2, $d3, $d4, $rawserver) = gethostbyname($hostname);
    $serveraddr = pack("Sna4x8", 2, $port, $rawserver);
    last if connect(SOCKET, $serveraddr);

    close(SOCKET);
    if (++$tries >= 5)
	{ print "Sorry, can't connect<P>"; exit; }
    sleep 1;
  }

  $length = length($content);

  $oldselect = select(SOCKET);
  $| = 1;

  print "$content";
  print "";

  select($oldselect);

};    #eval block
if ($@) { chomp $@; print($@); }



################## JAVA CLIENT CODE
import java.applet.Applet;
import java.awt.Graphics;
import java.net.ServerSocket;
import java.net.Socket;
import java.io.InputStream;
import java.io.DataInputStream;

public class listen extends Applet {
    public void paint(Graphics g)
    {
	try {
	    int port=1234;
	    ServerSocket readServer = new ServerSocket(port);
	    g.drawString("Server Socket created to " + port,10,20);
	    g.drawString("Awaiting a connection...",10,30);
	    
	    Socket connection = readServer.accept();
	    g.drawString("Connection accepted.",10,40);
	    
	    InputStream inStream = connection.getInputStream();
	    DataInputStream dis = new DataInputStream(inStream);
	    
	    boolean done=false;
	    while (!done)
	    {
		String line = dis.readLine();
		if (!line.startsWith("~READER_STOP~"))
		{
		    g.drawString(line,10,50);
		}
		else
		    done=true;
	    }
	    
	    readServer.close();
	} catch (Exception e)
	    {
		e.printStackTrace();
		System.exit(1);
	    }
    }
}



Many thanks if you can help me out.  My email address is jys @
hk.super.net


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

Date: 27 Mar 1998 07:58:50 -0500
From: Zach Kessin <zkessin@shell1.tiac.net>
Subject: Re: Perl server/Java client
Message-Id: <yc7afaccmt1.fsf@shell1.tiac.net>


Well Java will not let you open a server socket from an applet. Try
doing the reverse, I.E. Have perl open a server socket and then
connect from Java.

Good Luck
--Zach Kessin


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

Date: Fri, 27 Mar 1998 13:34:56 GMT
From: jdmelton@oz.sunflower.org (J. Daniel Melton)
Subject: Re: Please Help, Win95/NT4.0 Serial Port Usage Questions
Message-Id: <351ba840.863409@news.supernews.com>

On 26 Mar 1998 07:17:21 +0000, Jim Brewer <jimbo@soundimages.co.uk>
wrote:

>jdmelton@oz.sunflower.org (J. Daniel Melton) writes:
>
>> 
>> I wish to use Perl 5.004 Standard for communication with a couple of
>> RS232 devices on an Intel  Windows 95 platform. I wish to use Perl, I
>> know there are other tools for the job.
>
>I have been successful in reading and writing the serial port on Win NT
>and writing the serial port on Windows 95. I have not been successful
>reading the serial port on Win 95. In order to use the serial ports i have
>first made a system call to the mode command to set the port parameters
>and then opened a file handle to the port. In order to read and write I
>have used sysread and syswrite rather than read and write which make
>use of buffered IO. Sysread and syswrite enable you to control the number
>of bytes transfered and to poll the serial port within a loop.
>
>There has been a rumour of a Win 32 module for serial communications
>in development as we speak.
>
>The above attempts at serial comms have been made using the GS port of
>5.004_04 compiled on Win NT with MSVC 5. I cannot speak for the 
>Activestate port.
>
>HTH.
>Jim Brewer

I noticed an earlier post of yours. I am not familiar with the mode
command. Did you find another way? I would sure be interested
in learning how to do this. Any code examples you could provide would
be greatly appreciated! I am very new to the Win32 Perl world, I use
the standard, not the Activestate port.

Thanks,

Dan



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

Date: Fri, 27 Mar 1998 12:34:35 -0000
From: "Tony Kenny" <tony@cyberscape.net>
Subject: print crypt($password,$Salt); not working
Message-Id: <6fg74h$g3c$1@svr-c-02.core.theplanet.net>

The line:

print crypt($Password,$Salt);

works on one machine and returns nothing on another.

The perl version is correct etc..

Does anyone know why this might be?

~TK




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

Date: Fri, 27 Mar 1998 08:19:38 -0500
From: Dan Boorstein <dboorstein@shopcfn.com>
Subject: Re: print crypt($password,$Salt); not working
Message-Id: <351BA76A.35DD280A@shopcfn.com>

Tony Kenny wrote:
> 
> The line:
> 
> print crypt($Password,$Salt);
> 
> works on one machine and returns nothing on another.

is that the only line? if not, the rest of your code might help
in diagnosing the problem. can you boil it down to some small bit
that still shows the unexpected behavior? i would expect such
behavior from the line above. is the salt somehow coming up
empty on the version that is failing?

cheers,

-- 
danboo


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

Date: Fri, 27 Mar 1998 11:36:24 GMT
From: you@somehost.somedomain (User)
Subject: Re: PROPOSAL: The Perl Dictionary
Message-Id: <351b8f1d.332096299@news.btinternet.com>

Perlvert - one who insists that C can do it better...



On Thu, 26 Mar 1998 09:35:25 +1000, Ron Savage
<rpsavage@ozemail.com.au> wrote:

>Ed Finch wrote:
>> 
>> Perl is going to take over the world. Therefore, the word perl and its[snip]
>
>Perl n. The (Allegedly) Perfect Language - get it?. Obscurantistic lies pretend it stands for Pathologically 
>Eclectic Rubbish Lister, etc.
>
>-- 
>Cheers,
>Ron Savage
>Office: savage.ron.rs@bhp.com.au
>Home (preferred): rpsavage@ozemail.com.au
>Web: http://www.ozemail.com.au/~rpsavage



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

Date: Fri, 27 Mar 1998 12:05:02 +0100
From: lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)
Subject: Re: proposal: while $line (<FILE>)
Message-Id: <lassehp-2703981205020001@ra.imv.aau.dk>

In article <351B32F3.19B4B6B8@negia.net>, Dan Boorstein <danboo@negia.net>
wrote:

>  foreach $line (@file)

You mean:
foreach $line (<FILE>)

or
@file = <FILE>;
foreach $line (@file)

This works, but by creating a list first.

>  while $line (<FILE>)

I'd say that's uglier than while(defined ($line = <FILE>))

At least with the latter, the meaning is clear.

>any ideas, criticism?

I'd say it would be better to optimize certain styles of foreach, perhaps
by implementing the concept of an iterator. (Sorry, I'm no expert; pardon
me if I'm abusing a term for lack of a better word.) This would avoid
changing any syntax, and it would probably not be a harmful change of
semantics.

In most ordinary list contexts, an iterator would simply work as now.
But when used with foreach, the iterator would instead assume each of it
values successively instead of building the list.

Another candidate for this "iterator-context" behaviour besides <FILE>
would be the $n..$m range operator.

That way, it would be OK and efficient to write
foreach $i (0..$large_number) {
}

which I believe deserves merit from a readability viewpoint.

The <FILE> iterator would break _some_ semantic. For example, if the loop
was stopped with a "last" statement, then under current semantics, the
file would have been read completely, whereas with this new semantic,
there would possibly still be more to read from the file.

I note that perldoc perlop says about the range op:
"Be aware that under the current implementation, a temporary array is
created [...]"
which seems to imply that this could change. I'm not saying such a change
should include the use of <FILE> in the same place, but it could.

I think this is sometimes called lazy evaluation, so you might say it
would be a virtuous thing to implement. But the current implementation
could be called "impatient evaluation" (providing all values at once in a
list) so it's just as virtuous. :-)

-Lasse


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

Date: 27 Mar 1998 13:51:57 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: proposal: while $line (<FILE>)
Message-Id: <6fgatt$gkv@news-central.tiac.net>

In article <351B32F3.19B4B6B8@negia.net>,
Dan Boorstein  <danboo@negia.net> wrote:
>lately i've seen more and more mention of how:
>
>  while (<FILE>) # reads a solitary 0 from the last line
>                 # (i.e., magic 'defined')
>
>differs from:
>
>  while ($line = <FILE>) # fails to read a solitary 0 from the last
>                         # line (i.e., no magic 'defined')
>

Please note that the code is different, there's an extra $line = in the
second example.

Please note in the perlop man page:

     Evaluating a filehandle in angle brackets yields the next
     line from that file (newline, if any, included), or undef at
     end of file.  Ordinarily you must assign that value to a
     variable, but there is one situation where an automatic
     assignment happens.  If and ONLY if the input symbol is the
     only thing inside the conditional of a while or for(;;)
     loop, the value is automatically assigned to the variable
     $_.  The assigned value is then tested to see if it is
     defined.  (This may seem like an odd thing to you,

>  while $line (<FILE>)
>
>at the time i wasn't even aware of the magic going on in the
>case of isolated <>'s within a 'while'. i was just looking for a
>way to get my line reads into a scalar other than $_ (i was
>big on being explicit at the time. i'm all better now :).

  while (<FILE>) {
    $line = $_;			# use $line instead of perl's
				# usual default buffer, $_
  }

>any ideas, criticism?

perl gives you enough rope to hang yourself.  There are plenty of other
languages which keep the rope safely locked away...

Mike
-- 
mike@stok.co.uk                    |           The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/       |   PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/    |                   65 F3 3F 1D 27 22 B7 41
stok@colltech.com                  |            Collective Technologies (work)


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

Date: Fri, 27 Mar 1998 11:58:33 -0000
From: "Richard" <yellow*@cix.co.uk>
Subject: Redirect URL
Message-Id: <6fg40s$61a@news5-gui.server.cableol.net>

I have a perl script which is simply used to respond to a form
submission. Exiting the perl script I wish to display a 'thank you' but from
an html page on another server. Any suggestions on how I could do this
please?

--
Richard Heath







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

Date: Fri, 27 Mar 1998 03:55:31 -0600
From: audttjk@dbs.com.sg
Subject: Re: regular expression
Message-Id: <6ffstb$f3g$1@nnrp1.dejanews.com>

In article <slrn6hjp78.rdb.tranhu@derby.jsp.umontreal.ca>,
  tranhu@jsp.umontreal.ca wrote:
>
> Un jour, 8($J$Z6!*:2VE]$} (NortonNg.bbs@CHS.Dorm10.NCTU.edu.tw)
>      affirmait publiquement que:
>
> | just a simple question: how can I write a perl script to identify
> | all strings of 0's and 1's that do not contain the substring 011  ?
>
> using grep(! /011/, @array_of_strings);  ?
>
> | and another one is to identify all strings of digits with at most one
> | repeated digit.
>

sub is_valid {
    my (%digit,%repeat);
    eval {
        s/(\d)/++$digit{$1}>1 &&
               ++$repeat{$1}  &&
               scalar(keys %repeat)>1 && die/ego
    };
    $@;
}

# This might work

Jit Kiat Tan
audttjk@dbs.com.sg


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


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

Date: Fri, 27 Mar 1998 11:01:06 +0100
From: Jan Philipp Madsen <webmaster@madweb.net>
To: Luis Framit <vinfra@mad.servicom.es>
Subject: Re: S.O.S Necesito Adobe Page Maker Versisn 3.0 para Windows
Message-Id: <351B78E2.CEC41E7E@madweb.net>

Conjeturo que usted esta en el grupo incorrecto... o que esta allm
cualquier
relacisn entre el adobe Pagemaker y Perl??

I guess you are in the wrong group... or is there any relation between
Adobe
Pagemaker and perl ??

regards,
            Jan Philipp Madsen

Luis Framit schrieb:

> S.O.S.
>
> Necesito una versisn del Adobe Page Maker 3.0 para Windows. Si tienes
> alguna noticia por favor ponte en contacto conmigo.
>
> E_mail:  vinfra@mad.servicom.es
>
> Gracias





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

Date: Fri, 27 Mar 1998 13:48:59 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Searching for Larry Wall's humor and a Win32 file questions
Message-Id: <351da9a2.148109370@news.mmc.org>

[posted and mailed to the cited author]

On Thu, 26 Mar 1998 18:57:37 -0600, "Mark J. Danna" <mdanna@ghg.net> wrote:

>Here is my real question!
>
>Q.  I am looking for a function/module that returns Win32 file dates and
>sizes (as displayed in a directory command).  I believe that a dir
>filename.ext>>dir.txt can be used with the returned value being placed in an
>array, but has anyone written any functions/modules that returns these
>values?  I need these values for a comparison function when installing
>patches to applications.
>
>I am aware of the -x File Test (ref. page 121  "Learning PERL on Win32
>Systems, O'Reilly & Assoc.) and the stat Function (page 123), but these use
>PERL's Epoch age in the calculation for the creation/modification date.  I
>would like to believe that there is a more efficient way to return these
>values directly from the system.
>
>Thanks in advance,
>Mark

Mark, I answered this on 3/24, in message ID 35170414.113788039@news.mmc.org.
Dejanews has it, so maybe your news server is questionable?

Or did I misunderstand your question, perhaps not realizing that maybe you just
want to avoid stat() entirely?  'cuz you can't . . . at least not yet.

The dates aren't stored in the directory in human-readable format, so I don't
know why you think stat() is particularly inefficient. At least it returns
something with which you have some flexibility. A simple numerical comparison
of stat return values will indicate which file was created/modified first.
localtime/gmtime along with a little math and string manipulation will display
the value in any format you can imagine . . .

-- 
                               Jeffrey R. Drumm, Systems Integration Specialist
                       Maine Medical Center - Medical Information Systems Group
                                                            drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me


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

Date: 27 Mar 1998 10:53:33 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Someone put my munged e-mail address on a spam list
Message-Id: <6fg0fd$koc$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Russell Schulz <Russell_Schulz@locutus.ofB.ORG> writes:
:Tom Christiansen (co-author of Perl) also used to (still does?)
:demunge and put them on a special web page (and posts them).

I do still demunge them, and add them to a special table so that next
time I reply, it can automatically fix it.

Usenet is a public forum.  Cope.  I hate having to go out of the way to
send the private response that netiquette suggests.  It's quite rude.
But no, I don't send this table to spammers.  I don't know who the
spammers are, and even if I did, wouldn't go out of my way to send it
to them.

Fighting spam by address munging is like fighting speeding by not going
out of your house even to visit your friends.  It doesn't do anything
about the problem, and is a selfish pain in the butt.

I support fighting spam in these ways, in order of preference:

    1) Legal measures (likewise for junk snailmail and junk phone calls)
    2) ISP IP-filters and addr-blocking via sendmail 8.9, for example
    3) Personal filters


Whether, when, and why I reveal that table or its Perl code to others
is a different matter.  Currently, I favor doing so, and rude arguments
to the contrary will only hasten its publication. :-)

--tom, who finds "co-author of Perl" is a bit too hubristic even for him  :-)
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

"Patriotism is the virtue of the vicious."
 - Oscar Wilde


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

Date: Fri, 27 Mar 1998 05:41:48 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Still a novice (getting older) still needing RegExpr help....
Message-Id: <comdog-ya02408000R2703980541480001@news.panix.com>
Keywords: from just another new york perl hacker

In article <351b67b9.2334877@nntp.ibmpcug.co.uk>, stephenb@scribendum.win-uk.net posted:

>I've been reading and trying, but I'm still missing something here:

>open(PNFILE, "testPN_n.html") or die "Can't open testfile: $!\n";
>while (<PNFILE>) {
>        local $/ = undef;
>        print "line number: $.\n$_\n\<A HREF=\"$1\">$1\</A\>\n\n"
>#       if /\<!--webbot bot=\"Include\" u-include=\"(\w+\.html*)\"
>tag=\"BODY\" startspan\s*--\>\.*<!--webbot bot=\"Include\" endspan
>i-checksum=\"(\d+)\"\s*--\>/s
>#       if /<strong>(WW Notes* to)\.*(\d*.*\d+)<\/strong>/s
>        if /\<!--webbot bot=\"Include\" u-include=\"(\w+\.html*)\"
>tag=\"BODY\" startspan\s*--\>/
>}

you're missing a few things.  first, use generalized quoting to make
your stuff easier to read.  compare

   print "line number: $.\n$_\n\<A HREF=\"$1\">$1\</A\>\n\n"

to the use of a here document (tab over)

      print <<"DATA";
   line number: $.
   $_
   <A HREF="$1">$1</A>

   DATA

which is much easier to read.  also remember that inside of regexes
you can use \Q and \E to escape regex meta-characters, and that
long patterns benefit from the x modifier.  you should also avoid
escaping every character in sight.

as for the HTML matching bits, you're missing the nifty HTML::Parser
module, which, once you figure it out (not too tough, though), will
give you the power of ten web whackers and free you from your regex
fetish.

good luck :)

-- 
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 <URL:http://www.pm.org>


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

Date: 27 Mar 1998 11:43:03 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: trivial example reveals a taint problem?
Message-Id: <6fg3c7$mfl$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, 
    Bekman Stanislav <sbekman@iil.intel.com> writes:
:But why do you need $ENV{PATH}="/bin"; if you call your hostname with 
:full path? 

I explain why in the fine perlsec manpage, just where you would expect to
find such an answer.

--tom, who fears a return to the oral tradition for transmission of
    lore in our increasingly post-literate society.
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    I don't know if it's what you want, but it's what you get.  :-)
            --Larry Wall in <10502@jpl-devvax.JPL.NASA.GOV>


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

Date: Fri, 27 Mar 1998 07:13:58 -0800
From: Mark Folse <mfolse@dlprinting.com>
Subject: Re: Use CPAN with Windows 95's DOS prompt?
Message-Id: <351BC236.33C8@dlprinting.com>

Having been poking around for a better Perl for my poor home DOSneyland
box, I've looked at the mentioned port.

DJGPP is a GNU style compiler for Wintel systems. It also provides for
access to expanded memory. If you have access to DPMI memory management
(Win95 or 3.1 DOS console, for example) you won't need their available
expanded memory management module. Alas, it requires a math coprocessor,
of which I have none, and I haven't been able to get the emulator to
work. So I may have to build my own with the DJBPP compiler and put it
in the build.

In regard to an earlier posted on DOs ports, the ports I've looked at
all come with some sort of extended memory manager, so you're not
suffering from mem limitations. However, they are missing much of what
you'd find even in the Win32 ports (which are missing much of what you'd
find on UNIX).



You should look at the Win32 directories on CPAN for running under 95.

Jonathan Stowe wrote:
> 
> On Thu, 26 Mar 1998 02:32:42 GMT, ssmith@galina.enet.dec.com (Sheldon
> E. Smith) wrote:
> 
> >Hi. I'm trying to figure out how to configure and use CPAN on a
> >MickeySquish Windows 95 system. I'm running the DJGPP port of Perl 5:
> >
> >        This is perl, version 5.004_02
> 
> <snip>
> 
> DJGPP is a DOS extendor for 16bit DPMI systems.  You do not need to be
> using this with Win32. Get hold of the binary distribution for Win32.
> As far as I know there is no network support in the DJGPP port
> therefore the CPAN module will not work (I wish there was however).
> 
> /J\
> Jonathan Stowe
> See the MetaFaq at http://www.btinternet.com/~gellyfish/resources/wwwfaq.htm

-- 
 --
markfolse@rocketmail.com * mfolse at dlprinting dot com

"Is there any intelligent life here, 
or are you all starship commanders?"
			Codex Ipse

Here, spambot. Nice spambot. Here ya go, boy...
postmaster@localhost hostmaster@localhost 
spam@localhost abuse@localhost webmaster@localhost


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

Date: 27 Mar 1998 10:21:35 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: verifying email address -- how?
Message-Id: <6ffujf$je3$1@csnews.cs.colorado.edu>

 [courtesy cc of this posting sent to cited author via email]

In comp.lang.perl.misc, using a rude pain-in-the-ass spam-shrouded
address NerveGas@inconnect.com (whose real address has now been added
to a despammification table) writes:

:  But DO bother to check for shell escapes in their address, if your
:script will be working with system commands.  If you do something (very
:undesirable) like:
:
:system("cat temp.txt | mail $email_addr");
:

You give poor advice, sir.  Checking for shell escapes is wrong.
Not calling the shell at all is right.  Never use one-arged system
or exec, or backticks, or pipe opens with user input data.  Period.
Consider the fred&barney@stonehenge.com address, for example.  Perfectly
valid and deliverable.

The right way to do this is explained in perlsec.  You have to use a
forkopen and a manual, comma-separated exec.

You are running under -T aren't you?

And that was a useless use of cat.

--tom

--
Please don't send spam to NerveGas@inconnect.com
-- 
	Tom Christiansen	tchrist@jhereg.perl.com

    echo "I can't find the O_* constant definitions!  You got problems."
            --The Configure script from the perl distribution


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

Date: 27 Mar 1998 08:31:59 GMT
From: Stefaan.Eeckels@ecc.lu (Stefaan A. Eeckels)
Subject: Re: Where can I learn about linking C library with Perl?
Message-Id: <6ffo5v$bnb$1@justus.ecc.lu>

In article <351B0E78.ED7A012D@ns.koscom.co.kr>,
	kjyeo <kjyeo@ns.koscom.co.kr> writes:
> I want to know how I can link  c library with perl
> Pleae any one answer me..
Read the perlxs and perlxstut pages. It's quite easy,
and the perlxstut page explains it quite in depth.

-- 
Stefaan
-- 

PGP key available from PGP key servers (http://www.pgp.net/pgpnet/)
___________________________________________________________________
  "Don't worry about people stealing your ideas.  If your ideas
   are any good, you'll have to ram them down people's throats."
                                                -- Howard Aiken


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

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

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