[9004] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 2622 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun May 17 16:07:34 1998

Date: Sun, 17 May 98 13:00:41 -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           Sun, 17 May 1998     Volume: 8 Number: 2622

Today's topics:
        Credit Card Encryption/Decryption -help! hahnfeld@my-dejanews.com
    Re: Credit Card Encryption/Decryption -help! (Michael Budash)
    Re: Does Perl have a IDE?I don't like command line. (Stuart McDow)
    Re: Grieving our dying community <Rosie@dozyrosy.demon.co.uk>
    Re: How do I get the name of each file in a dir? (I R A Aggie)
    Re: How do I get the name of each file in a dir? (Johan Claeys)
    Re: How to generate random passwords? <rootbeer@teleport.com>
    Re: HTML Builder scripts <signa@tfs.net>
        I need to determine WHOLE numbers. HELP? (DAXMUX)
    Re: I need to determine WHOLE numbers. HELP? (Craig Berry)
    Re: I need to determine WHOLE numbers. HELP? (Jim Levie)
    Re: Is if ($a="something") a bad style? (brian d foy)
    Re: Need help from MacPerl expert! (Rich Morin)
        Perl & OLE\COM Inproc Servers <rejohn@ix.netcom.com>
        Perl and IE Active Channel <brians@meetingbywire.com>
        PERL Message 'offline mode:'  (Phil Taylor)
    Re: PERL Message 'offline mode:' <tchrist@mox.perl.com>
    Re: PERL Message 'offline mode:' (Hakan Hjelmstrom)
        Perl Script for System Backup? - 2 Questions <qre@wwr.com>
    Re: Perl Script for System Backup? - 2 Questions <phousto@cse.dnd.ca>
        print memory address? (Yun)
    Re: Regex problem: substituting 3+ identical characters (Bart Lateur)
    Re: Scanning Perl scripts for Y2K problems (Bart Lateur)
        sending regex matches to a separate file <michael@datahost.com>
        simple help with one-liner needed (newbie question) (Chris Croome)
    Re: Startup overhead (Michael Budash)
    Re: Umlauts in Perl search machines - help <rootbeer@teleport.com>
    Re: vec basics <rootbeer@teleport.com>
    Re: Which perl? (new user question) amr@miyako.japanologie.kultur.uni-tuebingen.de
    Re: while, each & assoc array (Tina Marie Holmboe)
    Re: while, each & assoc array <tchrist@mox.perl.com>
    Re: Why I got the wrong PID when I use "fork"? <rootbeer@teleport.com>
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Sun, 17 May 1998 15:38:24 GMT
From: hahnfeld@my-dejanews.com
Subject: Credit Card Encryption/Decryption -help!
Message-Id: <6jn09g$th3$1@nnrp1.dejanews.com>

I want to set up a perl CGI script that takes users' credit card numbers,
encrypts them, and stores them in a database.  Then an administrator
will run a separate script, enter the encryption key into a form, and see the
information.

I have been working on this for about a week now and it looks like the best
way to do this would be to have the user input script have a public key
hardcoded into the script and all user input is encrypted and stored. Then the
administration script takes the private key as form input at decrypts the
data, forming a nice report of transactions.  The private key is never stored
on the system, since the administrator must enter it each time to decrypt the
data.

I wanted to use the "export-a-crypto-system sig" to do it, but I cannot get it
to work.  It works fine on the command line, but when I try to open a pipe in
my program, no data is returned:

$data_to_encrypt = "$ccnum_$nameoncard_$expdate";
$encrypted_data = `echo $data_to_encrypt |
rsa.pl -k=3f306bc100483ce211b5d7d7868e185 -n=43a07dd3318d828a27e769f8a27f889`;

$decrypted_data = `echo $data_from_database | rsa.pl
-d -n=43a07dd3318d828a27e769f8a27f889 -k=$private_key_from_form`;

Any other suggestions?  Will PGP do what I want to do?  Will PGP work on
non-linux UNIXes?  Is there any way I could use secret-key encryption but
still make it secure?  I've tried stuff from the cryptix library, but
it doesn't want to install on my system and has no real documentation.

Someone must be doing credit card encryption like this somewhere!  Is anyone
else storing encrypted credit card information on their system?  How?  Please
help...  Any suggestions or code would be greatly appreciated.  I'm stuck :(

Thanks for your replies!

Matt

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


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

Date: Sun, 17 May 1998 12:42:51 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Credit Card Encryption/Decryption -help!
Message-Id: <mbudash-1705981242520001@d124.pm3.sonic.net>

In article <6jn09g$th3$1@nnrp1.dejanews.com>, hahnfeld@my-dejanews.com wrote:

[snip]

>> Will PGP do what I want to do? 

yes.

>> Will PGP work on
>> non-linux UNIXes?

several of them...

[snip]

>> Someone must be doing credit card encryption like this somewhere!  Is anyone
>> else storing encrypted credit card information on their system?  How?  Please
>> help...  Any suggestions or code would be greatly appreciated.  I'm stuck :(

pgp is the method i use to obscure credit card numbers, though i am not
storing them, per se, i am emailing them.

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: 17 May 1998 17:17:26 GMT
From: smcdow@arlut.utexas.edu (Stuart McDow)
Subject: Re: Does Perl have a IDE?I don't like command line.
Message-Id: <6jn636$f9i$1@ns1.arlut.utexas.edu>

abigail@fnx.com (Abigail) writes:
> 
> And there isn't a gcc port for NT yet?

Not one that I like. At any rate, a good gcc port won't change the
fact that NT is a closed system.

> If that's true, why are so many places converting to NT? Surely some
> places just go for the sales talk, but won't you think many places
> have the competence to do a cost analysis?

It is important to remember that popularity and quality are not
necessarily linked, especially when something is marketed as well as
NT is.

Having worked in the corporate world for some time (though not now), I
was continually amazed at the arbitraryness of large
expenditures. Cost analysis can easily (woefully easily) skewed
towards someone's individual preference. Though I have no data to back
it up other than anecdotes, I believe that this behavior is rampant in
the corporate world - moreso when the decision is made by
non-technical people (ie executives). Marketing plays a key role in
situations like this, and that's something that MS does well.

> Ah, yeah, Linux. The classical answer to Windows. 

For enterprise solutions, it's the only answer, IMO.

> I'm sorry, Linux is a nice OS, but many things that are available
> for NT or commercial Unices aren't available for Linux. There's no
> Sybase for Linux, or Oracle, or X-runner, or a lot of other
> (commercial) packages.

And commercial packages are important why?

> If Unix is all that wonderful, and NT so bad, then why worry about
> NT?

Ah, good point. I don't remember how this particular discussion got
started.

In fact, I don't worry too much about NT. But I do have to make
professional recommendations for networking and enterprise
solutions. For that reason, I do need to keep myself informed about
NT. For solutions that require a high degree of stability,
predictability, and reliability, I cannot in good conscience,
recommend NT. That is my humble and studied opinion. MS is marketing
their products very, very well. And, as we all know, in the brave new
world of computing, marketing is much more important than solid
engineering and reliability. Because of this, I think that MS will
ultimately win the OS wars. But winning the OS wars won't change the
fact that it is an inferior OS. (IMO).

--
Stuart McDow                                     Applied Research Laboratories
smcdow@arlut.utexas.edu                      The University of Texas at Austin
            "Look for beauty in roughness, unpolishedness"


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

Date: Sun, 17 May 1998 15:14:58 +0100
From: Rosemary I H Powell <Rosie@dozyrosy.demon.co.uk>
Subject: Re: Grieving our dying community
Message-Id: <ZFO6bCAiDvX1EwHZ@dozyrosy.demon.co.uk>

In article <6jesls$j9f$1@csnews.cs.colorado.edu>, Tom Christiansen
<tchrist@mox.perl.com> writes
> [courtesy cc of this posting sent to cited author via email]
>
>In comp.lang.perl.misc, 
>    sb@engelschall.com (Steffen Beyer) writes:
>:I think it should be possible for "newbies" to ask their beginner's questions
>:even if they are FAQs, because sometimes it's hard when one doesn't even know
>:where to start searching for an answer, given the overwhelming volume of
>:available Perl documentation.
>
>The clueless flock always to the .wizards groups, never the .neophytes group.
>
>--tom
The answer is obvious, wizards should whizz over to the neophytes group.
Rosemary
-------------------------------------------------------------------
| Rosemary I.H.Powell  EMail: Home: rosemary@dozyrosy.demon.co.uk |     
|                             Work: r.i.h.powell@rl.ac.uk         |
|                       http://www.netlink.co.uk/users/dozyrosy/  |
|                       http://www.dozyrosy.demon.co.uk/          | 
-------------------------------------------------------------------


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

Date: Sat, 16 May 1998 21:49:16 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <fl_aggie-1605982149160001@aggie.coaps.fsu.edu>

In article <355CB94F.DB1E4D3E@fao.ford.com>, Alan Turski
<aturski@fao.ford.com> wrote:

+ Ala,
+    The function you are looking for is called 'glob'.  Not all perl books list
+ it.  It is mentioned in "Using Perl 5 for Web Programming", Special edition,
+ on page 472.  In fact the example they give is exactly the printing you want
+ to do, viz.,
+ 
+ @files = glob("/tmp/*.txt");

So sayeth 'perldoc perlop':

Because globbing invokes a shell, it's often faster to call readdir() yourself
and do your own grep() on the filenames.  Furthermore, due to its current
implementation of using a shell, the glob() routine may get "Arg list too
long" errors (unless you've installed tcsh(1L) as /bin/csh).

James

-- 
Consulting Minister for Consultants, DNRC
The Bill of Rights is paid in Responsibilities - Jean McGuire
To cure your perl CGI problems, please look at:
<url:http://www.perl.com/CPAN-local/doc/FAQs/cgi/idiots-guide.html>


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

Date: Sun, 17 May 98 15:56:24 GMT
From: Johan.Claeys@ping.be (Johan Claeys)
Subject: Re: How do I get the name of each file in a dir?
Message-Id: <6jmtto$qak$1@news3.Belgium.EU.net>

Another way to do this is 
@files = </tmp/*.txt>;
 
Johan.

>Ala,
>   The function you are looking for is called 'glob'.  Not all perl books list

>it.  It is mentioned in "Using Perl 5 for Web Programming", Special edition,
>on page 472.  In fact the example they give is exactly the printing you want
>to do, viz.,
>
>@files = glob("/tmp/*.txt");
>
>
>
>Ala Qumsieh wrote:
>
>> Aaron wrote:
>>
>> > Mike Williams wrote:
>> > >
>> > > On Sun, 19 Apr 1998 12:38:42 -0500, Chocolate <poohba@io.com> wrote:
>> > > >How do I get the name of each file in a dir and print it?
>> > >
>> > > How about
>> > >
>> > > print `ls`;
>> > >
>> > I too have wondered about this.  I have had to resort to the above or
>> > also I have used $foo=`echo /some_dir/*`;
>> > But what if I'm on a different platform, win32?  Do we always have to
>> > resort to the shell to get a file list?  Hell we can chmod, chdir, mkdir
>> > and the like, but I can't find a "perl" command to list the files.
>> >
>> > Aaron
>>
>>  Haaaa???
>> You're telling me that you haven't heard of opendir() ???
>>
>> --
>> Ala Qumsieh             | "How much wood would a woodchuck
>> ASIC Design Engineer    |  chuck if a woodchuck could
>> Matrox Graphics Inc.    |  chuck wood?"
>> Montreal, Quebec        |             - Trivial ... 5!
>
>
>
>--
>Alan Turski
>Visteon - CAE Systems
>
>
>


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

Date: Sun, 17 May 1998 19:25:48 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: "Allan M. Due" <due@murray.fordham.edu>
Subject: Re: How to generate random passwords?
Message-Id: <Pine.GSO.3.96.980517121905.27629B-100000@user2.teleport.com>

On 15 May 1998, Allan M. Due wrote:

>     srand(time ^ ($$ + ($$ << 15)) );

Unless I'm missing something, you're calling srand every time that this
sub is called. So, if your sub is called twice in the same second, you'll
get the same password twice! 

In general, calling srand more than once is probably a mistake. 

As for the problem of getting good passwords, I'd recommend the ANLpasswd
program on CPAN, for starters. 

    http://www.perl.com/CPAN-local/scripts/admin/

Cheers!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/




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

Date: Sun, 17 May 1998 05:41:18 -0500
From: "Steve Nordquist of Overland Park" <signa@tfs.net>
Subject: Re: HTML Builder scripts
Message-Id: <6jmen6$oj8$1@sunset.kansas.net>

>I'm looking for cgi form-based HTML builders

Don't do it!  If you want to give users something to toy with,
give them some HTML demo or the Macromedia tool suite
if they pay enough!  ($550 a pop for Good Stuff, hey, be
a part of it!)

You can also make a good page cobbler out of JavaScript/
Java AND CGI, demanding a set of basic, EDITED texts
(and maybe images) up front
then encouraging people to add the tags and metadata
they should as they drag paragraphs around.




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

Date: 17 May 1998 18:24:43 GMT
From: daxmux@aol.com (DAXMUX)
Subject: I need to determine WHOLE numbers. HELP?
Message-Id: <1998051718244300.OAA19774@ladder01.news.aol.com>

If I have a number...say....1446.  And I divide that number by 3 it gives me
482.
If I have the number 1447 and I divide it by 3 it gives me 482.333....
If I have the number 1448 and I divice it by 3 it gives me 482.666....

What is the fastest, cleanest way to determine: if ($var / 3 = WHOLENUMBER)?

I know, I know...my biggest trouble is that I SUCK at math...my second trouble
is that I'm just a perl HACK.  

ANY ideas solving this problem would be SO helpful!

Email can be sent to:trh.nospammers@hps-inc.com
Just remove the ".nospammers"  Thanks! 

Tim


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

Date: 17 May 1998 19:06:13 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: I need to determine WHOLE numbers. HELP?
Message-Id: <6jncf5$t73$1@marina.cinenet.net>

DAXMUX (daxmux@aol.com) wrote:
: If I have a number...say....1446.  And I divide that number by 3 it gives me
: 482.
: If I have the number 1447 and I divide it by 3 it gives me 482.333....
: If I have the number 1448 and I divice it by 3 it gives me 482.666....
: 
: What is the fastest, cleanest way to determine: if ($var / 3 = WHOLENUMBER)?

  $divByThreeFlag = ! $var % 3;

% is the modulo operator; it return the remainder of a division.  If $var
is divisible by 3, that remainder will be zero; otherwise, it will be
nonzero.  Invert that logically, and you get true for divisible-by-three,
false otherwise.

---------------------------------------------------------------------
   |   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: Sun, 17 May 1998 19:25:23 GMT
From: Jim.Levie@dynetics.com (Jim Levie)
Subject: Re: I need to determine WHOLE numbers. HELP?
Message-Id: <355f355b.11161363@newstoo.hiwaay.net>

On 17 May 1998 18:24:43 GMT, daxmux@aol.com (DAXMUX) wrote:

>If I have a number...say....1446.  And I divide that number by 3 it gives me
>482.
>If I have the number 1447 and I divide it by 3 it gives me 482.333....
>If I have the number 1448 and I divice it by 3 it gives me 482.666....
>
>What is the fastest, cleanest way to determine: if ($var / 3 = WHOLENUMBER)?
>

To determine the integer results of the division of a scalar (quotient
and remainder) one would use:

$quotient = int($var/3);
$remainder = $var%3;

If you are only interested in determining if the scalar is evenly
divisable by some number testing the result of the modulus operator
"%", which returns the remainder,  will do it:

if($var%3 != 0) { print "$var isn't even;y divisible by 3\n"; }

>I know, I know...my biggest trouble is that I SUCK at math...my second trouble
>is that I'm just a perl HACK.  
>
>ANY ideas solving this problem would be SO helpful!
>
>Email can be sent to:trh.nospammers@hps-inc.com
>Just remove the ".nospammers"  Thanks! 
>
>Tim



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

Date: Sun, 17 May 1998 15:29:46 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Is if ($a="something") a bad style?
Message-Id: <comdog-ya02408000R1705981529460001@news.panix.com>
Keywords: from just another new york perl hacker

In article <6jk91k$4c0$1@monet.op.net>, mjd@op.net (Mark-Jason Dominus) posted:

>Me neither, actually.  I picked a bad example.  The `malloc' is very
>suggestive there.  But if you see something like
>
>        if (n = xpchk(z, i+k)) {
>           ...
>        }
>
>you really have no idea whether the = was correct, and you have to
>suspect that the programmer might have intended == instead.

in these instances i add a comment right above the line.  no need to
keep your readers guessing :)

-- 
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 T-shirts! <URL:http://www.pm.org/tshirts.html>


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

Date: Sun, 17 May 1998 08:02:25 -0700
From: rdm@cfcl.com (Rich Morin)
Subject: Re: Need help from MacPerl expert!
Message-Id: <rdm-1705980802250001@140.174.42.30>

In article <6jl8p7$9s7$1@resunix.sickkids.on.ca>, ali@genet.sickkids.on.ca
(Alex Dong Li) wrote:

> Dear MacPerl experts, especially experts internet connection,

Although a few MacPerl experts hang out on c.l.p.m, the real MacPerl
dialog takes place in the MacPerl email list.  You can join the list
via a form on the MacPerl Pages (http://www.ptf.com/macperl).

> I am trying to modify a unix/winNT version of web GET subroutine,
> which acts like a GET client, so that I can use it on Mac.
> When I tried the following script on Mac, I got the following message:
> "Cannot bind. No enough space"

If the error message isn't lying, it may be that you need to give the
MacPerl application more memory (via GetInfo).

-r

P.S.  Before handing huge piles of code to others for debugging, it's
      generally a good idea to boil them down a bit.  That is, work
      up a tiny bit of code that replicates the problem.  Often, this
      exercise will allow you to spot the problem yourself...

-- 
Canta Forda Computer Laboratory       | Prime Time Freeware - quality 
UNIX consulting, training, & writing  | freeware at affordable prices
+1 415-873-7841                       | +1 408-433-9662   -0727 (Fax)
Rich Morin, rdm@cfcl.com              | www.ptf.com, info@ptf.com


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

Date: Sun, 17 May 1998 12:30:36 -0700
From: "Regi John" <rejohn@ix.netcom.com>
Subject: Perl & OLE\COM Inproc Servers
Message-Id: <6jndt7$keo@dfw-ixnews4.ix.netcom.com>

The Win32 doc for OLE Automation states that Perl works only with .exes, not
 ..dlls (inproc servers)? Is this indeed the case, or is there a fix out there
somewhere?
Thanks in advance.

Regi




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

Date: Sun, 17 May 1998 14:06:54 GMT
From: "Brian Sullivan" <brians@meetingbywire.com>
Subject: Perl and IE Active Channel
Message-Id: <2aC71.617$Ue7.1195571@news.rdc1.on.wave.home.com>

Has anybody ever heard of Perl CGI that creates an IE CDF file. What I want
to do is automatically change the internal Last modified date (e.g.
LastMod="1998-01-15T00:01") to the latest date modified in a series of files
( the ones that are part of the channel).

Usually this is done as an ASP but since the web I want to do it for is
hosted on UNIX Perl seems the only way.






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

Date: Sun, 17 May 1998 11:01:15 GMT
From: phil@ackltd.demon.co.uk (Phil Taylor)
Subject: PERL Message 'offline mode:' 
Message-Id: <355ec252.7017561@news.demon.co.uk>

Could someone explain why I get the message:-

'offline mode: enter name=value pairs on standard input'

which is prompting for input when I run the script below. It seems to
happen every time I use a method from the CGI.pm module. 

#!/usr/bin/perl
use CGI;
$foo = new CGI;
print $foo->header;


Thanks

Phil Taylor


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

Date: 17 May 1998 13:42:01 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: PERL Message 'offline mode:'
Message-Id: <6jmpf9$2vu$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, 
    phil@ackltd.demon.co.uk (Phil Taylor) writes:
:Could someone explain why I get the message:-
:
:'offline mode: enter name=value pairs on standard input'
:
:which is prompting for input when I run the script below. It seems to
:happen every time I use a method from the CGI.pm module. 

% man CGI
    [...]
   -no_debug
       This turns off the command-line processing features.  If you want
       to run a CGI.pm script from the command line to produce HTML,
       and you don't want it pausing to request CGI parameters from
       standard input, then use this pragma:

	  use CGI qw(-no_debug :standard);

       See the section on debugging for more details.

    [...]

    DEBUGGING
       If you are running the script from the command line or in the
       perl debugger, you can pass the script a list of keywords or
       parameter=value pairs on the command line or from standard input
       (you don't have to worry about tricking your script into reading
       from environment variables).  You can pass keywords like this:

           your_script.pl keyword1 keyword2 keyword3

       or this:

          your_script.pl keyword1+keyword2+keyword3

       or this:

           your_script.pl name1=value1 name2=value2

       or this:

           your_script.pl name1=value1&name2=value2

       or even as newline-delimited parameters on standard input.

       When debugging, you can use quotes and backslashes to escape
       characters in the familiar shell manner, letting you place spaces
       and other funny characters in your parameter=value pairs:

          your_script.pl "name1='I am a long value'" "name2=two\ words"

--tom
-- 
"I think there's a world market for about 5 computers."
	- Thomas J. Watson, Chairman of the Board, IBM (around 1948)


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

Date: Sun, 17 May 1998 14:11:25 GMT
From: hawk@algonet.se (Hakan Hjelmstrom)
Subject: Re: PERL Message 'offline mode:'
Message-Id: <355eee11.70657249@news.algonet.se>

[CC of this post to author by mail]
On Sun, 17 May 1998 11:01:15 GMT, Phil Taylor wrote:
> Could someone explain why I get the message:-
> 'offline mode: enter name=value pairs on standard input'
> which is prompting for input when I run the script below. It seems to
> happen every time I use a method from the CGI.pm module. 
> #!/usr/bin/perl
> use CGI;
> $foo = new CGI;
> print $foo->header;

That's because you're running your script from the command line.
You then enter the form parameters as "name=value" and press enter
after each pair. When you're done, press CTRL+D (Unix) or CTRL+Z
(Windows/DOS). 
Check the first question in the CGI.pm documentation under "Frequent
problems" for more information on this.

Hekan Hjelmstrvm
hawk@algonet.se


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

Date: Sun, 17 May 1998 10:10:24 -0500
From: "Authorized User" <qre@wwr.com>
Subject: Perl Script for System Backup? - 2 Questions
Message-Id: <eb#1SZag9GA.313@nih2naac.prod2.compuserve.com>

I want a flexible and powerful script to backup selected
files on a WinNT system.
Rexx and Batch files are one answer.  Is there an advantage to Perl?
By the way, as I play with this idea it perplexes me that the Llama book
in chapter 13 describes renaming and deleting, but not copying files.

I looked in the Win32 release documentation and found Win32 extensions
that permit chdir, pwd,...equivalents, so indeed I can delete ,  rename,..,
but can't find out how to copy.




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

Date: Sun, 17 May 1998 16:23:15 GMT
From: Phil Houstoun <phousto@cse.dnd.ca>
Subject: Re: Perl Script for System Backup? - 2 Questions
Message-Id: <355F0F99.60649943@cse.dnd.ca>

Authorized User wrote:
> 
> I want a flexible and powerful script to backup selected
> files on a WinNT system.
> Rexx and Batch files are one answer.  Is there an advantage to Perl?
> By the way, as I play with this idea it perplexes me that the Llama book
> in chapter 13 describes renaming and deleting, but not copying files.
> 
> I looked in the Win32 release documentation and found Win32 extensions
> that permit chdir, pwd,...equivalents, so indeed I can delete ,  rename,..,
> but can't find out how to copy.

use File::Copy;
copy($infile, $outfile);

-- 

Phil Houstoun            Voice: (613) 991-7173 
Email: remove the 'j' in pjhousto@cse.dnd.ca
-----------------------------------------------------------------------


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

Date: Sun, 17 May 1998 14:15:34 GMT
From: mingtian@hanmail.net (Yun)
Subject: print memory address?
Message-Id: <355eee81.32037189@usenet.kornet.nm.kr>

$a=1;
$b=2;
print \*a," ",\*b,"\n";
print \$a," ",\$b,"\n";
--
it prints,
GLOB(0x74bdc8) GLOB(0x74bdec)
SCALAR(0x74bdd4) SCALAR(0x74bdf8)

but i am not sure which is the address of the variabl's symbol table
and which is the real data address?
If it's not correct way then what's the correct one of printing, such addresses?

here is the example, so how can i get the two addresses?

        |       symbol table        |
address | symbol |etc| real address |
0x01 -> |  $a    |...|    0x41      |
0x31 -> |  $a    |...|    0x47      |

 ..
0x41    | 1 |
0x47    | 2 |

and one more, can i print the content os specific address? like 0x34AC03 if
it's within my protective mode.


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

Date: Sun, 17 May 1998 12:27:26 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Regex problem: substituting 3+ identical characters with just one
Message-Id: <3560d682.4457658@news.tornado.be>

J|rgen P|nter wrote:

> In a first step, I print the man-pages to a file and
>then stript out all _ and  to get e.g. 'lllooookkk'.

You shouldn't strip out that block character first. It is part of the
symptom. It's a backspace. It's supposed to make make your printer move
one character position to the left.

You could do this repeatedly:

	s/(.)\1/\1/g

Until nothing gets replaced any more. Maybe like this:

	while (s/(.)\1/\1/) {}

Then get rid of the underscores + backspaces:

	s/_|_//g;

There. that should do it.
	Bart.


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

Date: Sun, 17 May 1998 12:20:50 GMT
From: bart.mediamind@tornado.be (Bart Lateur)
Subject: Re: Scanning Perl scripts for Y2K problems
Message-Id: <355fd1f5.3292698@news.tornado.be>

Randal Schwartz wrote:

>Bart> localtime() Y2K compliant? Yeah, right. Calculating years since 1900 is
>Bart> dubious, to say the least.

>Uh?  Huh?  Maybe dubious to you.  Not at all dubious to me.

>I'm just not following.

You're doing this on purpose? ;-)

Well OK. Why did they pick 1900 as a starting date? Why not 1922? That
would make just as much sense. So now we're in year 66. Makes sense. :-)

It would, at least, have the benifit of preventing people into treating
it as a 2-digit representation of the year. Whoops, there go most of the
Y2K bugs. In short: it is part of the problem.

>Or are you saying that anything that references Unix Epoch (seconds
>since jan 1, 1970) is *also* dubious because it has a basepointer
>that's not the year 0?

1970 was picked ONLY because if they had taken 1900 as a starting date,
they would have already run out of seconds (in a 32-bit integer
representation) by the time they started.

OTOH, I don't think anybody should start counting seconds since the
beginning of Christian time, as different countries have corrected their
calendar at different moments in time. But all before 1970. And even
before 1900.

	Bart.


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

Date: Sun, 17 May 1998 07:20:45 -0700
From: Michael Stearns <michael@datahost.com>
Subject: sending regex matches to a separate file
Message-Id: <355EF23D.5B63@datahost.com>

Hello:

I would like to open a bunch of text files in a directory, get all urls
and put them in another file, in a list.

How do I write a regex that takes each matching item and sticks it in a
separated variable (or maybe I should be putting them in an array?)

Thanks for any suggestions. Here's what I currently have below

#!/usr/local/bin/perl

foreach (@ARGV) {

		open (INFILE,"$_") || die ("Can't Open $_\n");
		@text=<INFILE>;
		$text=join("",@text);
		print "$text\n";

		while ($text=~s/(http:\/\/.*?)">/$1/) {

 		$text2=$text2.$1\n;
		
		
		}
	close (INFILE);
	open (OUTFILE,">list.txt") || die ("Can't Open $_\n");
	print OUTFILE ($text2);
}


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

Date: Sun, 17 May 1998 19:38:22 GMT
From: chris@atomism.demon.co.uk (Chris Croome)
Subject: simple help with one-liner needed (newbie question)
Message-Id: <356436f8.97335632@news.demon.co.uk>

Hi

I want to take a name from a database and translate it into
initials:-

Chris Croome -> CC

However it also needs to work with names made up of three or
four names.

This is what I have so far, it works but is not too elegant:

$_ ="chris david ernie fred grace";

$first = /(\w)/;
if ($first == "1") {
$first = $1; 
}
$second =  /\w\w+\W(\w)/;
if ($second == "1") {
$second = $1;
}
$third =  /\w\w+\W\w\w+\W(\w)/;
if ($third == "1") {
$third = $1;
}
$fourth =  /\w\w+\W\w\w+\W\w\w+\W(\w)/; 
if ($fourth == "1") {
$fourth = $1;
}
$initials = join("",$first,$second,$third,$fourth);
print $initials;


Any suggestions for improving it would be appreciated

Thanks




Chris

chris@atomism.demon.co.uk
http://www.atomism.demon.co.uk/


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

Date: Sun, 17 May 1998 12:37:34 -0700
From: mbudash@sonic.net (Michael Budash)
Subject: Re: Startup overhead
Message-Id: <mbudash-1705981237350001@d124.pm3.sonic.net>

In article <6jf6cq$r7j$3@csnews.cs.colorado.edu>, tchrist@mox.perl.com
(Tom Christiansen) wrote:
>> In comp.lang.perl.misc, 
>>     kathryn.nelson@usa.net writes:
>> :My question is: are there any other things I can do to reduce this further?
>> 
>>     % man perlfaq3
>>        How can I make my CGI script more efficient?
>> 
>> Answer: try Apache's mod_perl.  It really will make you
>> remarkably happy.
>> 

mr. c: i asked a client's host why they don't have mod_perl installed, and
got a "security concern" type of answer. something about "people could
write their own extensions" or some such.

so my question is this: are there any reasons you know of to *not* install
mod_perl?

tia-

-- 
Michael Budash, Owner * Michael Budash Consulting
mbudash@sonic.net * http://www.sonic.net/~mbudash
707-255-5371 * 707-258-7800 x7736


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

Date: Sun, 17 May 1998 19:55:33 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Trevor Wilson <wdp@wdp.net>
Subject: Re: Umlauts in Perl search machines - help
Message-Id: <Pine.GSO.3.96.980517125418.27629G-100000@user2.teleport.com>

On Sat, 16 May 1998, Trevor Wilson wrote:

> I need help on exactly how to declare, for example that the character =E4
> is &auml; and vice versa.

If one of the existing modules doesn't do what you need, you may be able
to use a s/// operator for this. Hope this helps!

--=20
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 17 May 1998 19:51:38 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: Barry Masterson <jbarrm@panix.com>
Subject: Re: vec basics
Message-Id: <Pine.GSO.3.96.980517125035.27629F-100000@user2.teleport.com>

On 15 May 1998, Barry Masterson wrote:

> Can anyone here recommend any books, web sites, etc that help describe
> how to understand and use the 'vec' function in perl? 

Beyond what's in the manpage, what are you looking for? 

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

Date: Sun, 17 May 1998 14:06:43 GMT
From: amr@miyako.japanologie.kultur.uni-tuebingen.de
Subject: Re: Which perl? (new user question)
Message-Id: <6jmqtj$mt5$1@nnrp1.dejanews.com>

Search on http://www.ptf.com/macperl/
Here you will find an online version of the MacPerl Book
"MacPerl: Power and Ease" and links to the MacPerl mailinglist
you should subscribe to.

For a beginner the Userinterface of MacPerl is much more friendly
than the one of UNIX-Perl.(Especially if you are not used to UNIX-
tools).
It's always a good idea to have a Linux-system at home and having
Perl on all your machines you use.

BTW, MacPerl is not 'just an development environment for UNIX-Perl' but
a powerful scripting-language for the Macintosh itself. What you can do
with AppleScript, you can do with MacPerl as well (and much more).



Andreas Marcel Riechert








In article <1998051619330600.PAA05884@ladder03.news.aol.com>,
  cgschmitt@aol.com (CGSchmitt) wrote:

> Hi,
>
> I'm just learning perl (I bought O'Reilly's Learning Perl yesterday) and am
> interested in experienced perl hackers' opinions of how I should proceed. ><I'll  be using perl primarily for cgi-scripts on unix servers. However, I'll probably
> be using my Powermac to learn perl and write the scripts. I understand that
> perl ports very well, but there are still some differences between MacPerl and
> Unix perl.
>
> What would be the best way for me to learn? Learn the basics on MacPerl and
> then alter my scripts for Unix, or learn on Unix in the first place. I do have
> an old 486 with Windows that I'm not really using too much. Would it be worth
> it (or possible) to make this a Unix machine?
>
> I'm somewhat new to programming - I have a little experience with Pascal and C,so I need someone out there to set me straight. Thanks in advance.



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


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

Date: 17 May 1998 13:32:57 GMT
From: tina@nicke.andreasen.se (Tina Marie Holmboe)
Subject: Re: while, each & assoc array
Message-Id: <6jmou9$q9i$2@news1.sol.no>

In article <355C981D.80927A72@atl.hp.com>,
	"David A. Lyons" <lyonsd@atl.hp.com> writes:

> *This* is sloppy and difficult to read:
 
  No, *that* is a matter of opinion. Which of course goes for the
  both of you. Would concentrate on the problem and not the indenting
  be hard ?



> This is neat and easy to read and keep track of braces:
> 
> function
> 	{
> 	block of code;
> 	}

  Personally I don't even ok code if I see the above when checking others
  work. YMMV.

-- 
  Tina Marie Holmboe
  Application Developer (Geeks'R'Us)         [tina@tech.scandinaviaonline.se]
  Scandinavia Online AB Development Dept.    (+46) 08 587 81000 (switchboard)
                                             (+46) 08 587 81189 (direct)


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

Date: 17 May 1998 14:01:06 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: while, each & assoc array
Message-Id: <6jmqj2$4ih$1@csnews.cs.colorado.edu>

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

In comp.lang.perl.misc, lyonsd@atl.hp.com writes:
:Tom Christiansen wrote:
:> That's because you didn't use -w, and have really lame indentation. 
:
:Why's that? 
:
:*This* is sloppy and difficult to read:
:
:function {
:	block of code;
:}

Please cite in what way that that code is sloppy.  What's
sloppy about it?  What is the difficulty in reading it? 
And why do you indent so far?

:This is neat and easy to read and keep track of braces:

No, it isn't.  See below.

:
:function
:	{
:	block of code;
:	}

First of all, I can't understand what the problem is with keeping 
track of braces.  Secondly, it's very hard to read, and irks Larry
and many of the rest of us core coders.

% man perlstyle

       Regarding aesthetics of code lay out, about the only thing
       Larry cares strongly about is that the closing curly brace of
       a multi-line BLOCK should line up with the keyword that started
       the construct.  

:It makes a big difference when you start getting into a lot of nested
:blocks.

Indeed it does, and there's a special place in Hell reserved for
those who put their braces at the same levels as there code.

Probably what's happening here is that you have CBD (C brain damage).
This is causes by the fact that an if, while, or for statement
can take as its target either one single statement, sans braces, or 
or a multiline block enclosed with braces.  The perpetual fear, not
altogether without justification, is that someone might forget the opening
brace, and end up with 

    while (i++ < 1)
	f();
	g();

which is really

    while (i++ < 1) {
	f();
    }
    g();

Rather than 

    while (i++ < 1) {
	f();
	g();
    }

Well, guess what?  Perl doesn't have that problem.  The braces
are *mandatory*.  Think of them as part of the keyword itself.
"if (condition) {" is BEGIN, and "}" is the END.  You aren't allowed
to leave of the open curly, so there is no problem.  You can't get
confused or lost in Perl.  You're only letting yourself be confused
where you shouldn't be.  Your strange brace notation just makes it
harder for the rest of us.  Please look in the Perl source code in C,
or in the Perl module source in Perl, for good examples. Please.

--tom
-- 
    if (instr(buf,sys_errlist[errno]))  /* you don't see this */
        --Larry Wall in eval.c from the 4.0 perl source code


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

Date: Sun, 17 May 1998 19:49:10 GMT
From: Tom Phoenix <rootbeer@teleport.com>
To: William Tang <wtang@flash.net>
Subject: Re: Why I got the wrong PID when I use "fork"?
Message-Id: <Pine.GSO.3.96.980517124500.27629E-100000@user2.teleport.com>

On 15 May 1998, William Tang wrote:

> exec 'tip -19200 /dev/ttya > test' unless $pid=fork();

You should really check the return value of fork; it may be returning
undef.

You should really check that exec succeeded; it may fail, causing your
program to continue. (After a fork, that would mean two processes
executing the same code.)

> # run some program here to write result to terminal then to file test
> `kill $pid`;

You shouldn't use backticks when you mean system. But you shouldn't call a
kill program when you should use the kill builtin. Of course, in this
case, $pid is probably the id of the shell which started tip, not the id
of tip itself. 

Hope this helps!

-- 
Tom Phoenix       Perl Training and Hacking       Esperanto
Randal Schwartz Case:     http://www.rahul.net/jeffrey/ovs/



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

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

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