[10154] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 3747 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 18 05:07:32 1998

Date: Fri, 18 Sep 98 02:00:20 -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           Fri, 18 Sep 1998     Volume: 8 Number: 3747

Today's topics:
    Re: Calling another script from perl dave@mag-sol.com
    Re: Can I run Perl program regularly? <pjm@hplb.hpl.hp.com>
    Re: can MSWord and Adobe PDF docs be read for indexing? <dejah@DejahsPrivateIce.com>
    Re: collecting string padding techniques <uri@sysarch.com>
    Re: collecting string padding techniques (Larry Rosler)
    Re: Dealing with hyphens at line break with regexp matc (Craig Berry)
    Re: finding out last Sunday dave@mag-sol.com
    Re: Gratuitous warning: Deep Recursion (Ilya Zakharevich)
    Re: Help with some code <Tony.Curtis+usenet@vcpc.univie.ac.at>
    Re: how safe is xor encryption ? <sturgess@ccis.adisys.com.au>
    Re: how safe is xor encryption ? <dejah@DejahsPrivateIce.com>
    Re: Javascript or Perl or Java? <gargl@worldnet.net>
    Re: making number a decimal (Larry Rosler)
    Re: more regex/pattern substitution (Larry Rosler)
    Re: more regex/pattern substitution (Craig Berry)
    Re: more regex/pattern substitution (Larry Rosler)
    Re: Newbie needs help (David A. Black)
        O'Reilly CGI Programming book <necom@NO-SPAMnecom.com>
    Re: O'Reilly CGI Programming book <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Perl implementation question <empower.eng@mci2000.com>
        Perl one-liners <asehbai@osf1.gmu.edu>
    Re: Perl truncate doesn't work but C truncate does? (Larry Rosler)
        perl wrapper to lie about system time? (Dr H. T. Leung)
    Re: print statement. Please help (Craig Berry)
        Problem with piping... (Bryan Pizzillo)
    Re: Problem with piping... <Tony.Curtis+usenet@vcpc.univie.ac.at>
        Regular Expressions for Reading Data jzobel@my-dejanews.com
    Re: Removing double entries from array (Larry Rosler)
        Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)

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

Date: Fri, 18 Sep 1998 08:01:09 GMT
From: dave@mag-sol.com
Subject: Re: Calling another script from perl
Message-Id: <6tt404$3fj$1@nnrp1.dejanews.com>

In article <36012FBC.FB5B4A8B@godzilla.tamu.edu>,
  Matt Turner <matt@godzilla.tamu.edu> wrote:
> Say that I wanted to call another shell script or perl script from
> perl.  How can I do this?  I think it has something to do with the
> "system command".  For example, say I wanted to call a script called
> runme with a -d parameter from perl.  Would this be how to do it:
>
> system ("runme -d")
>
> Also, does the perl script continue running once the srcipt "runme" is
> done running.  In other words,  does the script continue running, wait
> for the called script to finish, or terminate once the called script is
> called?

Matt,

I assume you ran 'perldoc -f system', which would have given you this (amongst
other useful info).

=item system LIST

Does exactly the same thing as "exec LIST" except that a fork is done
first, and the parent process waits for the child process to complete.
Note that argument processing varies depending on the number of
arguments.  The return value is the exit status of the program as
returned by the wait() call.  To get the actual exit value divide by
256.  See also L</exec>.  This is I<NOT> what you want to use to capture
the output from a command, for that you should use merely backticks or
qx//, as described in L<perlop/"`STRING`">.

If this doesn't answer your questions, you should probably raise a bug against
the Perl docs.

hth,

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

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


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

Date: Fri, 18 Sep 1998 08:20:17 GMT
From: "Paul Marsh" <pjm@hplb.hpl.hp.com>
Subject: Re: Can I run Perl program regularly?
Message-Id: <EzH0HE.8GC@hplb.hpl.hp.com>

If your using windows nt use the AT command,


D wrote in message <358ecba4.0@rapeme.kirov.ru>...
>Dear Sir/Madam
>
>How can I make a program that can run my Perl program regularly (daily)?
>
>Thanks in advance
>
>Best wishes
>
>




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

Date: Fri, 18 Sep 1998 00:36:56 -0500
From: Mary E Tyler <dejah@DejahsPrivateIce.com>
Subject: Re: can MSWord and Adobe PDF docs be read for indexing?
Message-Id: <3601F170.159F@DejahsPrivateIce.com>

Pat Trainor wrote:
> 
> Idea:
> 
> Read msword, excel, or pdf files for textual indexing for a search engine.
> They will be residing on a unix box and at my mercy.
> 
> What methods exist to read/catalogue the text in them? "strings"? There has
> to be a better answer, eh?! :)

try opening the file with a simple text editor. what do you see? i see
the ascii text and alot of nonsense... seems like something could be
done.

> 
> Bonus Question:
> 
> What is required (even for $$$) that enables perl to write data in msword,
> excel, pdf formats?

knowing the file format of course.

dejah
-- 
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com


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

Date: 18 Sep 1998 00:08:11 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: collecting string padding techniques
Message-Id: <x74su6xduc.fsf@sysarch.com>


as i expect, our beloved abby stood up to the challenge and produce a
long list of padd technique, some more intersting and intriguing than
others. i will discount the loop ones since there are too many ways to
append/prepend a sincle char.
>>>>> "A" == Abigail  <abigail@fnx.com> writes:


these are very similar to my substr ones, just using s/// instead.

  A> # Right padded:
  A> $text =~ s/(.*)/$1 . ' ' x ($pad_len - length $1)/e;
  A> # Left padded:
  A> $text =~ s/(.*)/' ' x ($pad_len - length $1) . $1/e;

these two are intriguing. they do the max pad and truncate the extra pad
with s///

  A> # Right padded:
  A> substr ($text .= ' ' x $pad_len, $padlen) =~ s/.+//;
  A> # Left padded:
  A> substr ($text = " " x $pad_len . $text, 0, -$pad_len) =~ s/.+//;

this is too wierd. and an awful lot of electrons are killed for it.

  A> # Right padded:
  A> join "" => grep {$i ++ < $pad_len} (split // => $text), ' ' x $pad_len;

these are boring while loops

  A> # Right padded:
  A> $text .= " " while length $text < $pad_len;
  A> # Left padded:
  A> $text = " $text" while length $text < $pad_len;
  A> # Right padded:
  A> $text =~ s/$/ / while length $text < $pad_len;
  A> # Left padded:
  A> $text =~ s/^/ / while length $text < $pad_len;

ok, abby is using map! the map/chop is cooler than split //. the inner
map could have been subsumed in the outer one. i wonder if not using $_
in a map block is as big a no-no as map in a void context?

  A> # Right padded
  A> $text = reverse join "" => map {length () ? $_ : " "}
  A>                            map {chop $text} 1 .. $pad_len;

5.005 for modifiers. cool but still just loops

  A> # Right padded
  A> $text .= " " for 1 .. $pad_len - length $text; print "<$text>\n"'
  A> # Left padded
  A> $text = " $text" for 1 .. $pad_len - length $text; print "<$text>\n"'

this is cool. using ^ to extend the length and then s/// to make \0 into
blanks. 

  A> # Right padded (will fail if text contains \0s)
  A> ($text ^= "\0" x $pad_len) =~ s/\0/ /g;

even better. using ^ again to extend but recovering the original text
with another ^. shades of the CC# encryption thread!

  A> # Right padded (will fail if length $text > $pad_len).
  A> $text ^= " " x $pad_len ^ " " x length $text;

this one doesn't compile at all. 

  A> Etc....

uri

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


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

Date: Fri, 18 Sep 1998 00:22:37 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: collecting string padding techniques
Message-Id: <MPG.106baa176c0b9cfc989865@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <sar4su68l2e.fsf@camel.fastserv.com> on 17 Sep 1998 17:51:21 -
0400, Uri Guttman <uri@camel.fastserv.com> says...
 ...
> # right padding with blank
> 
> $padded = sprintf( "%{$pad_len}d", $num ) ;

  $padded = sprintf( "%-${pad_len}d", $num ) ;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 18 Sep 1998 04:25:35 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Dealing with hyphens at line break with regexp match
Message-Id: <6tsnbv$j4$2@marina.cinenet.net>

Jedediah D. Parsons (jed@glug.hip.berkeley.edu) wrote:
: How does one search for a pattern in a text file in which someone has
: already broken and hyphenated some words at line end?
: 
: That is, how would I be sure to get both occurrences of ``incredible''
: in the following text:
: 
: 	Incredible as it sounds, there is an incred-
: 	ible amount of incredulity ...

Assuming that the hyphenation always consits of a /-\n/ sequence dropped
into the middle of the word, and that the whole file is in scalar $text,
and also that you want to grab instances regardless of line location, I'd
first massage away the hyphens, then do my search: 

  $text =~ s/(\w)-\n(\w)/$1$2/g;

  my @incredibles = $text =~ /\bincredible\b/ig;

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Fri, 18 Sep 1998 08:17:49 GMT
From: dave@mag-sol.com
Subject: Re: finding out last Sunday
Message-Id: <6tt4vb$4mk$1@nnrp1.dejanews.com>

In article <6ts75e$sbn$2@client3.news.psi.net>,
  abigail@fnx.com wrote:
> Steve . (syarbrou@ais.net) wrote on MDCCCXLIII September MCMXCIII in
> <URL: news:3601865a.1360881@news.ais.net>:
> ++ I have a program that basically states:
> ++
> ++ Stats for the current week through xx/xx/xx
> ++
> ++ What I would like to do is say something like:
> ++
> ++ Stats for the week starting on xx/xx/xx
> ++ where the xx/xx/xx above is the Sunday for the current week.  In other
> ++ words if this is Monday, I want yesterday's date.  I could store the
> ++ info in a file when the logs are cleared, but figured there was a
> ++ cleaner way of doing it.  Thanks.
>
> perl -MDate::Manip -wle 'print UnixDate ParseDate ("last sunday"), "%x"'

Or if you don't have Date::Manip, you could do something like:

perl -e 'print scalar localtime(time - ((localtime)[6] * 24 * 60 *60))'

hth,

Dave...

--
dave@mag-sol.com
London Perl M[ou]ngers: <http://www.mag-sol.com/London.pm/>

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


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

Date: 17 Sep 1998 18:07:14 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Gratuitous warning: Deep Recursion
Message-Id: <6trj4i$jra$1@mathserv.mps.ohio-state.edu>

[A complimentary Cc of this posting was sent to Hans Mulder 
<hansmu@xs4all.nl>],
who wrote in article <6tk75m$fa1@news.euro.net>:
> >Isn't it my business how deeply I recurse?
> 
> Not entirely: there's a limit to how far your platform allows
> you to recurse.  What happens if you reach the hard limit is
> platform dependent; typically you get some obscure message,
> such as "Illegal instruction -- core dumped".

Not with Perl's malloc() (Perl's recursion is not using C's stack).

Ilya


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

Date: 18 Sep 1998 09:33:18 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Help with some code
Message-Id: <83hfy5euyp.fsf@vcpc.univie.ac.at>

Re: Help with some code, Kris <krisb@users.qual.net> said:

Kris> I was hoping someone could help me with the following.
Kris> In the part that is bold below I need to to recognize
                          ^^^^
Huh?

Kris> a string of 6 characters.  What I have on my site is a
Kris> password system and I need this script to verify that
Kris> a pin has been entered that is 6 characters long,
Kris> containing words and/or letters.

Kris> foreach $pair (@pairs) { ($name, $value) = split(/=/,
Kris> $pair); $value =~ tr/+/ /; $value =~
Kris> s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
Kris> $value =~ s/<([^>]|\n)*>//g; $value =~ s/<//g; $value
Kris> =~ s/>//g; # count order items and check if sending
Kris> check if ($name eq "pin" && $value > 0) {$CKpin = 1}

You're doing CGI right?

    use CGI;

documentation is "perldoc CGI".  This will make your life a
whole lot easier.


Kris> --------------C301E6D1CB8C3901223FAE3B Content-Type:
Kris> text/html; charset=us-ascii Content-Transfer-Encoding:

I'd get rid of this from your postings if I were you, it
looks disgusting!

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Fri, 18 Sep 1998 12:46:50 +0800
From: GAZZA <sturgess@ccis.adisys.com.au>
Subject: Re: how safe is xor encryption ?
Message-Id: <3601E5BA.97FEDF8C@ccis.adisys.com.au>

Felix S. Gallo wrote:
> 
> beyret@my-dejanews.com writes:
> >if the secret key is not an easy to remember key, than all these
> >are useless.
> >that's why i did not want its length to be restricted with
> >CC#+expiration. if a shorter secret key is supplied, then the
> >script will generate the other parts from the supplied one.
> 
> Length is not an important thing _at all_.
> 
> Entropy is the only important thing.

Err... we're talking about XOR here, right?

Let us suppose I have a key that is 4 bits long. Say, 0110.

The following 'plaintext' numbers encrypted with this key
give these results:

10110 xor 0110 = 10000
110110 xor 0110 = 110000

IOW, it means that there is a definite drop in entropy if
you decrease the length of the key to less than the length
of the plaintext - the above example shows that MSBs are
not encrypted at all.

A trivial example would be a 1 bit key, where I only have
to guess that single bit. Or a 0 bit key, where
ciphertext = plaintext.

I understand you're suggesting that entropy causes length,
rather than length causes entropy. While I agree that
extending the length does not automatically increase the
entropy of the key, REDUCING the length automatically DECREASES
the entropy of the key. So I think the two are interdependent,
rather than entropy being the determining factor.
-- 
Cheers,
GAZZA


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

Date: Fri, 18 Sep 1998 00:44:48 -0500
From: Mary E Tyler <dejah@DejahsPrivateIce.com>
Subject: Re: how safe is xor encryption ?
Message-Id: <3601F346.3D77@DejahsPrivateIce.com>

Mark-Jason Dominus wrote:
> 
> In article <36016B0B.56AF@DejahsPrivateIce.com>,
> Mary E Tyler  <dejah@DejahsPrivateIce.com> wrote:
> >why 53.15 bits...
> 
> One decimal digit contains the same information as 3.322 binary
> digits.  A credit card number is 16 digits long, so it contains
> 16*3.332 = 53.15 bits of information.  (Less, if you discount for the
> check digits.)
> 
> > and how do you have  15% of a bit...
> 
> In exactly the same way that the average family has 2.6 children.

i'll ask Matthew's pardon, for feeling so dumb... 

HUH!!!???

stupid self taught programmer.

dejah
-- 
i trust i make myself obscure, i have need of obscurity now- robert bolt

a heated exchange of unread mail would be welcomed by all- christensen

Skating Fiction. Featuring the  highly acclaimed serial On The Edge!
http://www.DejahsPrivateIce.com


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

Date: Fri, 18 Sep 1998 09:09:53 +0200
From: "GaRgL" <gargl@worldnet.net>
Subject: Re: Javascript or Perl or Java?
Message-Id: <6tt0uc$ht0$1@minus.oleane.net>

>Please can somebody clarify the difference between  using Javascript, Java,
>Perl? As a Beginner what should a person know to start off with Internet
>Programming?


javascript : small work, form checking, roll overs, etc...
java : animations, real-time, etc...
perl : working with files, anything you need to remember later (eg. forums,
guest books)




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

Date: Fri, 18 Sep 1998 00:07:44 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: making number a decimal
Message-Id: <MPG.106ba69828d0e0f5989864@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6trg3f$b49$1@nnrp1.dejanews.com> on Thu, 17 Sep 1998 17:15:28 
GMT, splonka@my-dejanews.com <splonka@my-dejanews.com> says...
> I'm stuck trying to get my number to print out in decimal format, like dollar
> amounts.
 ...
> $sub =~ s/(\d+)\.*(\d*)/$1\.$2/;
 ...

I wouldn't use a regex substitution for this task (though it wouldn't be 
hard to).  If you want two decimal digits:

  $sub = sprintf '%.2f', $sub;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 17 Sep 1998 23:47:20 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: more regex/pattern substitution
Message-Id: <MPG.106ba1d6a909c690989863@nntp.hpl.hp.com>

In article <6trdlk$e32$2@marina.cinenet.net> on 17 Sep 1998 16:33:56 GMT, 
Craig Berry <cberry@cinenet.net> says...
 ...
>   my %casemap = ( phd => 'PhD',
>                   edd => 'EdD',
>                   foo => 'fOo' };
> 
>   # ... get line to be transformed into $_ ...
> 
>   s/(\w+)/exists $casemap{lc $1} ? $casemap{lc $1} : $1/eg;

As we can be fairly confident that any value found in %casemap is TRUE 
(after all, we put them there ;-), we could write simpler and faster:

    s/(\w+)/$casemap{lc $1} || $1/eg;

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 18 Sep 1998 07:11:36 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: more regex/pattern substitution
Message-Id: <6tt138$5mu$1@marina.cinenet.net>

Larry Rosler (lr@hpl.hp.com) wrote:
: In article <6trdlk$e32$2@marina.cinenet.net> on 17 Sep 1998 16:33:56 GMT, 
: Craig Berry <cberry@cinenet.net> says...
: ...
: >   my %casemap = ( phd => 'PhD',
: >                   edd => 'EdD',
: >                   foo => 'fOo' };
: > 
: >   # ... get line to be transformed into $_ ...
: > 
: >   s/(\w+)/exists $casemap{lc $1} ? $casemap{lc $1} : $1/eg;
: 
: As we can be fairly confident that any value found in %casemap is TRUE 
: (after all, we put them there ;-), we could write simpler and faster:
: 
:     s/(\w+)/$casemap{lc $1} || $1/eg;

I wanted to avoid having casemap entries with keys for every word in the
file and undef values springing into existence, hence my longer form.  The
output is the same, but for a large doc, the hash (and hence memory size
and lookup times) might get rather bloated.

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: Fri, 18 Sep 1998 01:10:03 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: more regex/pattern substitution
Message-Id: <MPG.106bb5368cc725e5989867@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6tt138$5mu$1@marina.cinenet.net> on 18 Sep 1998 07:11:36 GMT, 
Craig Berry <cberry@cinenet.net> says...
> Larry Rosler (lr@hpl.hp.com) wrote:
> : In article <6trdlk$e32$2@marina.cinenet.net> on 17 Sep 1998 16:33:56 GMT, 
> : Craig Berry <cberry@cinenet.net> says...
> : ...
> : >   my %casemap = ( phd => 'PhD',
> : >                   edd => 'EdD',
> : >                   foo => 'fOo' };
> : > 
> : >   # ... get line to be transformed into $_ ...
> : > 
> : >   s/(\w+)/exists $casemap{lc $1} ? $casemap{lc $1} : $1/eg;
> : 
> : As we can be fairly confident that any value found in %casemap is TRUE 
> : (after all, we put them there ;-), we could write simpler and faster:
> : 
> :     s/(\w+)/$casemap{lc $1} || $1/eg;
> 
> I wanted to avoid having casemap entries with keys for every word in the
> file and undef values springing into existence, hence my longer form.  The
> output is the same, but for a large doc, the hash (and hence memory size
> and lookup times) might get rather bloated.

One of us has a blind spot.  I hope it isn't me.

If I understand you correctly, you imply that evaluating the expression

$casemap{foo} || $bar

causes an entry $casemap{foo} to spring into existence with an undef 
value.  This isn't so.  Attempting to retrieve the value of a nonexistent 
key does not create such a key and value.  It simply returns undef, which 
is FALSE in the boolean context.

#!/usr/local/bin/perl -w
use strict;

my %hash;
$hash{foo} || print(scalar keys %hash, "\n");
__END__

prints 0.
 
-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: Thu, 17 Sep 1998 20:46:56 EDT
From: dblack@saturn.superlink.net (David A. Black)
Subject: Re: Newbie needs help
Message-Id: <6tsai0$scs$1@earth.superlink.net>

Maxim Weinstein <weinstem@bms.com> writes:

>I'm a perl newbie, though I have a _little_ C programming experience.
>I'm trying to create a script that does significant file manipulation,
>but I'm unsure how to do it, even after looking over a few perl
>resources.

>OK, this is what I want the script to do:

>Take two arguments:
>(1)  The filename of a plain-text file
>(2)  A string of text, possibly several paragraphs in length

>The script would back up the file specified in (1), then probably read
>in that file and the string specified in (2), and ultimately write (to


"Probably"?!

if (int rand 3) {
	open (IN, "<$filename") ....
}


Seriously, I would agree with Alastair.  Break your task down into
manageable subtasks, such as opening/reading/printing out a file,
and try your hand at it, with resources and reference materials
nearby.

David Black
dblack@saturn.superlink.net


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

Date: Fri, 18 Sep 1998 02:56:35 -0400
From: "Ed A." <necom@NO-SPAMnecom.com>
Subject: O'Reilly CGI Programming book
Message-Id: <3602041D.9B6D4D@NO-SPAMnecom.com>

Does anyone have any tips on installing the "Sprite" SQL utility from
this book? Sprite has almost no documentation. It says that:

"If you _dont_ have access to the Perl library, then you can simply
copy the file Sprite.pm from the distribution to any directory
you choose and then add the following to the top of your script.

 #!/usr/local/bin/perl5

        use lib '/home/user/lib';

 use Sprite;

The example assumes you have copied Sprite.pm to /home/usr/lib. "


Has anyone tried this? It doesn't seem to work on my system. (Linux with
Apache server)

Thanks.


Ed


Remove NO-SPAM from email.




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

Date: 18 Sep 1998 09:35:49 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: O'Reilly CGI Programming book
Message-Id: <83g1dpeuui.fsf@vcpc.univie.ac.at>

Re: O'Reilly CGI Programming book, Ed
<necom@NO-SPAMnecom.com> said:

Ed> Does anyone have any tips on installing the "Sprite" SQL
Ed> utility from this book? Sprite has almost no
Ed> documentation. It says that:

Ed> The example assumes you have copied Sprite.pm to
Ed> /home/usr/lib. "

Ed> Has anyone tried this? It doesn't seem to work on my
Ed> system. (Linux with Apache server)

And, erm, how about actually saying what doesn't work?
Error messages?  Screen shots of output?  Sample code that
demonstrates the problem?

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Fri, 18 Sep 1998 00:15:13 -0700
From: "empower.eng" <empower.eng@mci2000.com>
Subject: Perl implementation question
Message-Id: <AcoM1.163$cF5.161921@news.mci2000.com>

Hi,
I have my code that's kind of implemented and worked, but I know there is a
better way,
can some Perl expert give me some idea.

What I have now is
($H1, $H2, $D1, $D2, $D3) = split(/:/);
and it works fine.

But the list on the left side is in multiple places and I know they will be
changed, more or less.
What I like to be able to do is (not correct Perl syntax).
$Header = ($H1, $H2);
$Data = ($D1, $D2, $D3);
Then
($Header, $Data) = split(/:/);
And better yet able to use $Header and $Data to print.

I tried a number quoting methods and none seems to work for me. Any idea and
help is greatly appriciated.

--Van




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

Date: Fri, 18 Sep 1998 02:41:48 -0400
From: Aamir Sehbai <asehbai@osf1.gmu.edu>
Subject: Perl one-liners
Message-Id: <Pine.OSF.3.96.980918023938.30301A-100000@osf1.gmu.edu>


Is there a collection of Perl one-liners somewhere on the Web?



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

Date: Fri, 18 Sep 1998 00:37:01 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Perl truncate doesn't work but C truncate does?
Message-Id: <MPG.106bad7bebf7a00b989866@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <6tsh4n$kdf$1@pegasus.csx.cam.ac.uk> on 18 Sep 1998 02:39:19 
GMT, Dr H. T. Leung <htl10@cus.cam.ac.uk> says...
> Can somebody tell me why this piece of perl script doesn't work? It just silently
> ignore me (no "can't open"), just nothing. The file I wanted it to truncate 
> was 680M, nothing happens; no error messages.
> 
> #!/usr/bin/perl
> open (HAHA, "/win95D/CD/data11.mpg")
>  or die "can't open!\n";
> truncate HAHA, 630000000;
> close (HAHA);

You opened this file for reading only.  You cannot then change it.  You 
got no error messages because you didn't check to see whether the 
'truncate' worked.

Try this:

  #!/usr/bin/perl -w
  open (HAHA, "+</win95D/CD/data11.mpg")
   or die "can't open! $!\n";
  truncate HAHA, 630000000
   or die "can't truncate! $!\n";
  close (HAHA);

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

Date: 18 Sep 1998 06:02:54 GMT
From: htl10@cus.cam.ac.uk (Dr H. T. Leung)
Subject: perl wrapper to lie about system time?
Message-Id: <6tst2e$rec$1@pegasus.csx.cam.ac.uk>


Is it possible to have a perl wrapper to lie about the system time for testing
y2000 compilance? (i.e. the system time is a different value as far as a command
executed inside a script is concerned) Changing the system clock seems a bit
tedious...

-- 
          --------------------------------------------------
"What you don't care cannot hurt you."            Chap. 7a, AMS-NS


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

Date: 18 Sep 1998 04:19:21 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: print statement. Please help
Message-Id: <6tsn09$j4$1@marina.cinenet.net>

nguyen.van@imvi.bls.com wrote:
: I have this problem. The following is my code:
: 
: ----------------------------------------------------
: 
: ($day, $month, $year) = (localtime)[3,4,5];
: $current_date = printf ("%04d%02d%02d", $year+1900, $month+1, $day);
: chop ($current_date);

Do you really want to lop off the second digit of the day number?

: printf "$current_date\n";
: 
: up to this point, it's alright but have problem with the folowing:
: I want to concatenate strings together
: 
: $out_put =  $current_date . ".browser.html";
: print $out_put, "\n";
: 
: however, this doesn't work for me any idea?

"Doesn't work" in what sense?  What do you want to happen, and what
actually happens?

---------------------------------------------------------------------
   |   Craig Berry - cberry@cinenet.net
 --*--    Home Page: http://www.cinenet.net/users/cberry/home.html
   |      "Ripple in still water, when there is no pebble tossed,
       nor wind to blow..."


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

Date: 18 Sep 1998 07:35:17 GMT
From: sturm@cs.umd.edu (Bryan Pizzillo)
Subject: Problem with piping...
Message-Id: <6tt2fl$fmg$1@cronkite.cs.umd.edu>

	I have a small problem with emulating:
	(cd foo && gtar cf name) | (cd /bar && gtar xpf)

	Here's what I have so far:

if (chdir("${DUMPS}/${HOSTNAME}")){
	open(GTAROUT,"gtar cif - $name|") or die "Could not open gtar for reading\n";
} else {
	logtosys("..Could not open ${DUMPS}/${HOSTNAME}");
        exit 15;
}
if ((chdir("/mnt3")){
        open(GTARIN,"|gtar xipf -") or die "Could not open gtar for writing\n";
} else {
        logtosys("..Could not open /mnt3");
        exit 15;
}
while(<GTAROUT>) {
        print GTARIN $_;
}
close(GTAROUT);
close(GTARIN);


	Now, the problem is that it has worked ok for every user I have
done this with, but tonight I hit a user where I got the error of:
Could not open gtar for writing

	The person's directory has nothing strange in it.  In fact it is
perfectly normal.  For some reason though, the gtar cannot open.  It is
really driving me buggy.  Anyone know what might be wrong or have a better
solution?  I have noticed that gtar and perl do not like each other much.
I had to put i's in the gtar options because the pipes would die on 0 length
files.  

Much Thanks in advance.

--
  
As always, just shoot me.
   ______ 
  (
___)TuRm


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

Date: 18 Sep 1998 09:51:12 +0200
From: Tony Curtis <Tony.Curtis+usenet@vcpc.univie.ac.at>
Subject: Re: Problem with piping...
Message-Id: <83emt9eu4v.fsf@vcpc.univie.ac.at>

Re: Problem with piping..., Bryan <sturm@cs.umd.edu> said:

Bryan> ((chdir("/mnt3")){ open(GTARIN,"|gtar xipf -") or die
Bryan> "Could not open gtar for writing\n"; } else {

Bryan> 	Now, the problem is that it has worked ok for every
Bryan> user I have done this with, but tonight I hit a user
Bryan> where I got the error of: Could not open gtar for
Bryan> writing

Perhaps it is something to do with the user and permissions
for /mnt3 ?

hth
tony
-- 
Tony Curtis, Systems Manager, VCPC,    | Tel +43 1 310 93 96 - 12; Fax - 13
Liechtensteinstrasse 22, A-1090 Wien,  | <URI:http://www.vcpc.univie.ac.at/>
"You see? You see? Your stupid minds!  | private email:
    Stupid! Stupid!" ~ Eros, Plan9 fOS.| <URI:mailto:tony_curtis32@hotmail.com>


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

Date: Fri, 18 Sep 1998 07:47:05 GMT
From: jzobel@my-dejanews.com
Subject: Regular Expressions for Reading Data
Message-Id: <6tt35o$2pi$1@nnrp1.dejanews.com>

Hi.

I would like to use something like for example

/(?:(?:(\d*);)*\n)/go

to read data like

33;44;55;23524538;
2;
33;64576;2353425234;

Unfortunately $1 is a bit 'small'. It only reads 2353425234. It should better
be a reference to an array of references to arrays:

$1 = [[33,44,55,23524538],[2], [33,64576,2353425234]]

With this, regular expressions would be a perfect tool for reading all kinds
of especially weird data formats.

Is there a patch or extension for the regex machine which gives me that?

Thanx,
Joachim

Also the from header contains a valid email adress replies to user@kud.com
where user = jzobel are prefered.

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


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

Date: Thu, 17 Sep 1998 23:39:22 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Removing double entries from array
Message-Id: <MPG.106b9ff16ca181df989862@nntp.hpl.hp.com>

[Posted to comp.lang.perl.misc and copy mailed.]

In article <36023e32.24208563@news.datacomm.ch> on Thu, 17 Sep 1998 
16:59:17 GMT, Marc-A. Woog <mwoog@pobox.ch> says...
 ... 
> I have tons of entries in @url_list, sometimes two or more times the
> same. I want to remove all redundant entries and this is the code I
> came up 'til now:

You got several workable responses, but this is the shortest: RTFM.

perlfaq4:  "How can I extract just the unique elements of an array?" 

-- 
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com


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

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

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