[12499] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 6099 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jun 22 19:07:10 1999

Date: Tue, 22 Jun 99 16: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           Tue, 22 Jun 1999     Volume: 8 Number: 6099

Today's topics:
    Re: [q] Timing of a simple looping cycle PERL vs C (Benjamin Franz)
    Re: [Req:] Date::Abigail (Lee)
    Re: aarrggghhh opening a file... (Larry Rosler)
    Re: accessing a character in a string (Larry Rosler)
    Re: AIX, sar and perl (what am I doing wrong?) <emschwar@rmi.net>
        bulk email using SendMail <mrdank@sprintmail.com>
    Re: can you split a word into letters? (Larry Rosler)
    Re: catching directory updates <rootbeer@redcat.com>
        deleting whitespace <tfiedler@ptd.net>
    Re: Displaying Adds <rg@fubar.net>
    Re: Exporting variables from a module <rootbeer@redcat.com>
    Re: floundering with fork.... <rootbeer@redcat.com>
    Re: How to find and delete or replace a section in a li (Larry Rosler)
        img2pl.pl (Filip M. Gieszczykiewicz)
    Re: move file pointer? <cassell@mail.cor.epa.gov>
    Re: newbie PWS idiocy part 2 <rootbeer@redcat.com>
        perl : use something like an applescript "property" (Barbara and Rory Campbell-Lange)
    Re: Perl Modules and Win98 <cassell@mail.cor.epa.gov>
    Re: Please help: Delete Reg Key with Sub-Keys. roberthp@my-deja.com
    Re: Statistics for comp.lang.perl.misc (J. Moreno)
        test <zeng@stat.Berkeley.EDU>
    Re: test <revjack@radix.net>
    Re: time question (Paul David Fardy)
    Re: unable to create or rename files in subdirectories (Tad McClellan)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Tue, 22 Jun 1999 22:48:26 GMT
From: snowhare@long-lake.nihongo.org (Benjamin Franz)
Subject: Re: [q] Timing of a simple looping cycle PERL vs C
Message-Id: <_oUb3.412$4s.65038@typhoon-sf.snfc21.pbi.net>

In article <7kor9i$gg9@cypress.nwnet.net>, Dean Hudson <deanh@nwnet.net> wrote:
>In article <376fea66@cs.colorado.edu>,
>Tom Christiansen  <tchrist@mox.perl.com> wrote:
>...
>>From K&P99:
>>    PLATFORM        250mhz Irix     400mhx pII MS   line count
>>    C               0.36 sec        0.30 sec        150
>>    Java            4.9             9.2             105
>>    C++/STL/deque   2.6            11.2             70
>>    C++/STL/list    1.7             1.5             70
>>    Awk             2.2             2.1             20
>>    Perl            1.8             1.0             18
>...
>
>For those interested also see "Timing Trials, or, the Trials of Timing:
>Experiments with Scripting and User-Interface Languages" by Kernighan
>and Van Wyk for more detailed and task specific benchmarks of various
>languages.

<URL:http://cm.bell-labs.com/cm/cs/who/bwk/interps/pap.html>

;)

-- 
Benjamin Franz


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

Date: Tue, 22 Jun 1999 17:50:49 -0500
From: rlb@intrinsix.ca (Lee)
Subject: Re: [Req:] Date::Abigail
Message-Id: <B3957D799668160EFD@204.112.166.88>

In article <slrn7mu70s.k1b.abigail@alexandra.delanet.com>,
abigail@delanet.com (Abigail) wrote:

>Lee (rlb@intrinsix.ca) wrote on MMCXX September MCMXCIII in
><URL:news:B394004B9668E2912D@204.112.166.88>:
>^^ Have you considered making your date functions available to the great
>^^ unwashed masses? And may I request an update for WebTV time?
>
>
>One of my sigs does.

But I wanted a complete Date::Abigail module, with easy access to your
fancy leapyear functions. I even have a contribution:

sub is_this_a_leap_year_p {
    #just can't kick that Lisp habit
    
    # WARNING: only tested for post-February conditions
    # complete testing will take several years
    
    # humantime() returns (yyyy, mm, dd, ...)
    # doesn't everyone have one?
    # the devil made me do it
    
    if ((humantime())[1] > 2) 
        { print 'dunno'; return }

    else {
        while ((humantime())[1] < 1)
            { sleep(24*60*60) }
        while ((humantime())[2] < 28)
            { sleep(24*60*60) }
        sleep(24*60*60)
        }
    
    if ((humantime())[2] == 29)
        { print 'yes'; return 1 }
    else
        { print 'no'; return 0 }
    
    }

It could be improved, I'm sure, but I exhausted my annual cleverness quota
getting this far with it.

Lee




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

Date: Tue, 22 Jun 1999 14:53:15 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: aarrggghhh opening a file...
Message-Id: <MPG.11d9a5a14fb2db52989c23@nntp.hpl.hp.com>

In article <376FFFFC.2ADF446A@mail.cor.epa.gov> on Tue, 22 Jun 1999 
14:28:28 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Casey Tweten wrote:
 ...
> > *oye*  open ( IDOUT, ">$forumfile" ) || die "Couldn't open: $!";
 ...
> I prefer 'or' in the above construct so I don't hit the
> precedence wall here.
> 
> open IDOUT, ">$forumfile" or die "Couldn't open: $!";
> 
> No savings on number of characters (sorry, LR  :-) but
> I like it.

You saved two parentheses, plus extra spaces that some folks put around 
them (see above).  I like it too -- surprise!

Actually, I like it because I have developed a style that uses && and || 
to signify normal logical processing of similar expressions, with short-
circuiting, and 'and' and 'or' to signify a flow-of-control change, as 
in the above example.  That is what the ultra-low precedence implies to 
me: one 'clause' or another 'clause'; i.e., more than 'just' an 
expression.

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


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

Date: Tue, 22 Jun 1999 15:19:38 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: accessing a character in a string
Message-Id: <MPG.11d9abd9fc4c6903989c26@nntp.hpl.hp.com>

In article <7kovfe$osr@news.or.intel.com> on Tue, 22 Jun 1999 14:35:26 -
0700, Ariel <fake@nospam.edu> says...
> hi. you know how in C you can say
> 
> char mystring[ ] = "hello";
> char myletter = mystring[1];  #myletter is the character 'e'
> 
> is there a way to do a similar thing in Perl? how do you access certain
> characters in strings?

perldoc -f substr

But in Perl it's not necessary as often as in C, because one has many 
functions to process strings, rather than just characters in strings.  
Look through perlfunc for the happy details.

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


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

Date: 22 Jun 1999 15:58:13 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: AIX, sar and perl (what am I doing wrong?)
Message-Id: <xkfiu8flwy2.fsf@valdemar.col.hp.com>

jgruiz1@ibm.net writes:
> The script works, but it never saves data to the output file
> "sar.out" until the close(SARF) gets executed. What should I
> do to save data to the output file after every sample (line)?

Read the FAQ.

Specifically, perlfaq5: "How do I flush/unbuffer a filehandle?  Why must
I do this?"

> Any ideas?? by the way, I am running perl 5.004_04 under AIX
> 4.3.2.

Then you have all the documentation you need on your system already.  30
seconds spent on your computer is well worth 30 hours (or even 30
minutes) waiting for someone to send a reply to a newsgroup posting.

-=Eric


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

Date: Tue, 22 Jun 1999 18:03:43 -0400
From: "Dani Koesterich" <mrdank@sprintmail.com>
Subject: bulk email using SendMail
Message-Id: <7kp13v$84l$1@holly.prod.itd.earthlink.net>

Hello,

I revised a script of mine, and now it sends out all of the emails in
the email address database, however after it is done it gives me a
"Cannot find server" error and does not display the Success message.
My script is below, and I would greatly appreciate it if someone
could help me out.  Thank You.

#!/usr/local/bin/perl -w

require "cgi-lib.pl";
&ReadParse;

&Display_Admin if ($in{'admin'} eq '1');

&No_Access if (!($in{'password'}));
&No_Access if (!($in{'database'}));
&No_Access if (!($in{'subject'}));
&No_Access if (!($in{'from'}));
&No_Access if (!($in{'message'}));
&No_Access if (!(&Check_Password));
&No_Database if (!(-e "$in{'database'}"));
&No_Message if (!(-e "$in{'message'}"));

#Set Variables
$pw = $in{'password'};
$database = $in{'database'};
$subject = $in{'subject'};
$from = $in{'from'};
$message = $in{'message'};
$mailprog = '/usr/sbin/sendmail';

open(DATABASE, $database);
@Addresses = <DATABASE>;
close(DATABASE);
$count = 0;

open (MESSAGE, $message);
@Message = <MESSAGE>;
close(MESSAGE);

foreach $address(@Addresses){
 chomp $address;
 $highload = ".6";
 while (($currload = &Load) > $highload) {
  sleep 20;
 }
 &Send_It_Out;
 ++$count;
}
#sleep 200;

print "Content-type: text/html\n\n";
exit;
print <<HTML;
<html>
<head>
<title>Successful</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p align="center"><Font face="Arial" size="4" color="#FF0000"><B>Mailout
Successful!</B></Font></p><BR>
<font face="Arial" size="3">Your $message has been sent to $count
people!</font>
</body>
</html>
HTML
exit;

sub No_Access{
 print "Content-type: text/html\n\n";
 print <<NoAccess;
<html>
<head>
<title>No Access</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p align="center"><Font face="Arial" size="4" color="#FF0000"><B>You do not
have access to this file</b></font></p>
</body>
</html>
NoAccess
exit;
}

sub No_Database{
 print "Content-type: text/html\n\n";
 print <<NoDatabase;
<html>
<head>
<title>No Database Found!</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p align="center"><Font face="Arial" size="4" color="#FF0000"><B>No Database
Found!</B></Font></p>
<BR><Font face="Arial" size="3" color="#000000">The file $database has not
been found.  Make sure it is in the same directory as this script.</font>
</body>
</html>
NoDatabase
exit;
}

sub No_Message{
 print "Content-type: text/html\n\n";
 print <<NoMessage;
<html>
<head>
<title>No Message Found!</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p align="center"><Font face="Arial" size="4" color="#FF0000"><B>No Message
Found!</B></Font></p>
<BR><Font face="Arial" size="3" color="#000000">The file $message has not
been found.  Make sure it is in the same directory as this script.</font>
</body>
</html>
NoMessage
exit;
}

sub Check_Password{
 return '1' if ((lc $in{'password'}) eq 'avigayil');
}

sub Send_It_Out{
 open(MAIL,"$mailprog -t -oi -odd");
 print MAIL "To: $address\n";
 print MAIL "From: $from\n";
 print MAIL "Subject: $subject\n\n";
 foreach $line(@Message){
  print MAIL "$line";
 }
 close (MAIL);
}

sub Display_Admin{
print "Content-type: text/html\n\n";
print <<Admin;
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Send Out Bulk E-Mail</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">

<p align="center"><font color="#FF0000" face="Arial" size="4"><b>Send Out
Bulk E-Mail</b></font></p>

<form method="post">
  <div align="center"><center><table border="0" cellpadding="2" width="80%">
    <tr>
      <td width="56%" align="left" valign="top"><font face="Verdana"
size="2" color="#0000FF"><b>E-Mail
      Database Filename:</b></font><br>
      <font face="Verdana" size="2" color="#000000"><small>Note: must be in
same directory as
      this script and must be in following format:<br>
      Email1\@Host1.com<br>
      Email2\@Host2.com<br>
      etc.</small></font></td>
      <td width="44%" align="left" valign="top"><input type="text"
name="database"
      value="database.lst" size="30"></td>
    </tr>
    <tr>
      <td width="56%" align="left" valign="top"><font face="Verdana"
size="2" color="#0000FF"><b>From:</b></font><br>
      <font face="Verdana" size="2" color="#000000"><small>Note: if you want
your name
      displayed, use:<br>
      &quot;Name Name&quot; &lt;email\@host.com&gt;</small></font></td>
      <td width="44%" align="left" valign="top"><input type="text"
name="from"
      value="&quot;Name Name&quot; &lt;email\@host.com&gt;" size="30"></td>
    </tr>
    <tr>
      <td width="56%" align="left" valign="top"><font face="Verdana"
size="2" color="#0000FF"><b>Subject:</b></font></td>
      <td width="44%" align="left" valign="top"><input type="text"
name="subject" size="30"></td>
    </tr>
    <tr>
      <td width="56%" align="left" valign="top"><font face="Verdana"
size="2" color="#0000FF"><b>Ascii
      Message File</b></font><br>
      <font face="Verdana" size="2" color="#000000"><small>Note: file must
be in same directory
      as this script.</small></font></td>
      <td width="44%" align="left" valign="top"><input type="text"
name="message"
      value="message.txt" size="30"></td>
    </tr>
    <tr>
      <td width="56%" align="left" valign="top"><font face="Verdana"
size="2" color="#0000FF"><b>Password:</b></font></td>
      <td width="44%" align="left" valign="top"><input type="password"
name="password" size="30"></td>
    </tr>
    <tr>
      <td width="100%" colspan="2" align="center" valign="top"><input
type="submit"
      value="Send Out Mail"></td>
    </tr>
  </table>
  </center></div>
</form>
</body>
</html>
Admin
exit;
}

sub Load {
    # Test system load and wait if it's too high
    @uptime = split(/,/, `uptime`);
    $fraction = $uptime[3];
    $load = (split /:/, $fraction)[1];
    return $load;
}





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

Date: Tue, 22 Jun 1999 15:07:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: can you split a word into letters?
Message-Id: <MPG.11d9a8f924e676e2989c24@nntp.hpl.hp.com>

In article <7kovo9$abg$0@216.39.141.200> on 22 Jun 1999 21:38:17 GMT, 
Fuzzy Warm Moogles <tgy@chocobo.org> says...
> On Tue, 22 Jun 1999 08:09:25 -0700, lr@hpl.hp.com (Larry Rosler) wrote:
> >> In article <slrn7mrfec.k1b.abigail@alexandra.delanet.com>,
> >>   abigail@delanet.com wrote:
> >...
> >> > sub pohc (@) {
> >> >     my $r;
> >> >     foreach my $s (@_  ?
> >> >                    @_  :
> >> >                    $_) {
> >> >         $s = reverse $s;
> >> >         $r = chop    $s;
> >> >         $s = reverse $s;
> >> >     }
> >> >     $r;
> >> > }
 ...
> Do not disparage Abigail's reverse chop.  It actually does pretty well,
> beating out the more serious split suggestions.

You wrote it a whole lot better.

 ...
>   Pohc   => sub { local $_ = reverse $word; chop },

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


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

Date: Tue, 22 Jun 1999 15:51:09 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: catching directory updates
Message-Id: <Pine.GSO.4.02A.9906221545360.1698-100000@user2.teleport.com>

On 22 Jun 1999, Edward P Scholl wrote:

> i have a script that does a bunch of file conversions when called.  
> is there a way to have the script "listen" to the directory, so when a
> new file is added, it automaticall starts the conversion?

You could keep a list of files known to be in the directory. Then,
periodically, check to see if there are any new files. But beware of
processing a half-written file! Perhaps you'll want the program writing
the new files to signal that it's done in some way. Good luck!

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



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

Date: Tue, 22 Jun 1999 22:32:15 GMT
From: "ted fiedler" <tfiedler@ptd.net>
Subject: deleting whitespace
Message-Id: <P9Ub3.3018$I72.384814@nnrp1.ptd.net>

how do i delete whitespace or for what its worth any junk on a line?

thanks in advance
ted





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

Date: Tue, 22 Jun 1999 14:57:20 -0700
From: "Rich G." <rg@fubar.net>
Subject: Re: Displaying Adds
Message-Id: <7kp0tr$8jg$1@birch.prod.itd.earthlink.net>

j_a_p@my-deja.com wrote in message <7kov8d$kn1$1@nnrp1.deja.com>...
>I want to write a simple function that displays adds and changes the
>picture every so often.  I know this can be done using JavaScript, but
blah blah blah...
>at the top of the deja page.  An add apears and after a while an knew
>add appears.

Seeing as how this is a Perl newsgroup, and not a JavaScript newsgroup,
you're asking the wrong group of people, and they're especially angry
right now because of ignorant people like you who waste their time with
questions that start with "I don't know anything about programming and I'm
too busy playing Quake to bother learning, but I'd like to do a huge
mega-web
thing and I'd like you to tell me exactly how to do it!"

Pick up a book.  Read it.  Get a clue.

JAPissedOffPH,
Rich G.







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

Date: Tue, 22 Jun 1999 15:55:59 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: Exporting variables from a module
Message-Id: <Pine.GSO.4.02A.9906221555140.1698-100000@user2.teleport.com>

On Tue, 22 Jun 1999, evil Japh wrote:

> 	$::variable = 10;			# assumes current package

Perlfaq7 says:

    Note that the notation $::var is I<not> the dynamic
    $var in the current package, but rather the one in the C<main>
    package, as though you had written $main::var.

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



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

Date: Tue, 22 Jun 1999 15:14:21 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: floundering with fork....
Message-Id: <Pine.GSO.4.02A.9906221508580.1698-100000@user2.teleport.com>

On Tue, 22 Jun 1999, Dave wrote:

> disclaimer:  I'm new to perl  :-)
> 
>    I am grepping from a large text file for use later in my script.  Is
> it possile to have a forked child take care of the grep while the parent
> goes on to sub menu which has a few options any of which need the
> @grepped_text from the child?  How do I get the array from child to sub
> whatever?

You probably want the methods of the perlipc manpage. But I hope that,
even if you're new to Perl, you're not new to the programming issues
you'll find there - it's not trivial stuff. 

If your perl has threads, you may be able to do this with threads. It may
or may not be easier.

Another way to attack this program may be to keep some kind of index to
the file, which could mean less (or no) grepping. This is potentially a
very big project, though.

Cheers!

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



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

Date: Tue, 22 Jun 1999 15:10:27 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: How to find and delete or replace a section in a line
Message-Id: <MPG.11d9a9b29ab127e4989c25@nntp.hpl.hp.com>

In article <37700340.1C530204@mail.cor.epa.gov> on Tue, 22 Jun 1999 
14:42:24 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> Vox wrote:
 ...
> > "ineedhelpinfindinganddeletingasectioninastring"
> > 
> > and the section of this line above that I want to delete or replace is
> > 'findinganddeleting'
> > Does anyone have any suggestions?
> 
> You might want to use perldoc (or man or your browser) to read
> whatever version of the docs you prefer, and check out the
> substr() function.

And index() and length() (unless you enjoy counting characters by hand).  
All in all, a regex is a lot simpler.

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


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

Date: 22 Jun 1999 22:55:16 GMT
From: fmgst+@pitt.edu (Filip M. Gieszczykiewicz)
Subject: img2pl.pl
Message-Id: <7kp48k$683$1@usenet01.srv.cis.pitt.edu>

Had a look in CPAN and net and couldn't find something that took an image
(actually, any binary per se) and spit out something that could be
included in the perl-source (to enable only 1 file distribution, with
files needed generated on demand)... so here's a quick hack:

(generates a commented-out source for an example)

-----------------chop-with-axe----------------chop-with-axe---------------------
#!/usr/bin/perl -w
$pgm = "img2pl.pl V1.0";
# by Filip "I'll buy a vowel" Gieszczykiewicz
# http://www.repairfaq.org/filipg/
#
$file = $ARGV[0];
#
# Read handle
open (HANDLE,$file)
	or die ("Can't open '$file'\n");
# Write handle
open (OUT,">$file.pl")
	or die ("Can't write '$file.pl'\n");

# ensure binary mode
binmode(HANDLE);

$name = $file;
$name =~ tr/\./_/;				# saves headaches later
print OUT <<EOF;
#!/usr/bin/perl
# In-line version of an image of '$file' by $pgm
\@$name = ( 
EOF
#
$count = 0;
$firstline = 0;
$once = 0;
$wrote = 1;
#
# Read file byte at a time
while ($got = sysread(HANDLE,$buffer,1)) {
	last unless defined $got;
	$buf = ord($buffer);			# char to ascii
	if (!$once++) {
		printf(OUT "\"%d\"",$buf);	# first byte this format
		next;
	}	
	printf(OUT ",\"%d\"",$buf);		# rest bytes this format

	# This crap ensures that output is nicely formatted - nice if
	# you have textmode cut&paste (ie. Linux)
	$len = 4 if ($buf <= 9);		# ,"1"
	$len = 5 if ($buf > 9);			# ,"10"
	$len = 6 if ($buf > 99);		# ,"255"
	if ($count > 62 && !$firstline) {
		$count =0, $firstline = 1;
		print OUT "\n";
	}
	if ($count > 70) {
		$count =0;
		print OUT "\n";
	}
	$wrote++;
	$count += $len;
}
print OUT <<EOF;
);
#
# Example of using this data:
#
open (OUTPUT,">$file")
	or die ("Couldn't create '$file'\\n");
binmode(OUTPUT);	# ensure file written is unmolested
for \$byte (\@$name) {
     printf(OUTPUT "%c", \$byte);
}
close (OUTPUT);
#
EOF
#
print "Wrote $wrote bytes to '$file.pl'\n";
close (OUT);
close (HANDLE);
-----------------chop-with-axe----------------chop-with-axe---------------------

Is this agreeable? I'm hacking a local "dumb home page generator" which
creates a really silly home page for our local system here... some silly
images are used to spiffy up the pages. If user expands home page and
reruns this pgm, it will check all the file permissions and fix what's
broken... we have unix and AFS permissions to putz with... and the
typical "I think I know how to turn my PC on" user isn't too comfy with
doing this all by hand :-)

Example output:

-----------------chop-with-axe----------------chop-with-axe---------------------
#!/usr/bin/perl
# In-line version of an image of 'atom.gif' by img2pl.pl
@atom_gif = (
"71","73","70","56","57","97","32","0","32","0","242","7","0","0","0","0"
,"0","255","0","4","0","195","130","130","255","255","0","0","255","130","130"
,"255","255","255","190","190","190","33","249","4","5","0","0","7","0"
,"44","0","0","0","0","32","0","32","0","64","3","175","120","186","220","254"
,"80","149","55","207","120","215","5","88","132","23","198","231","101"
,"26","230","144","71","197","168","81","90","176","208","32","183","205"
,"36","18","184","65","4","188","69","55","23","30","175","32","44","166"
,"126","139","25","242","133","108","58","23","48","152","143","129","138"
,"72","113","184","83","171","7","253","132","112","162","169","130","203"
,"32","43","6","132","130","65","39","242","176","204","218","5","118","32"
,"61","254","80","85","232","234","201","239","251","255","125","42","76"
,"24","36","121","14","82","44","121","134","135","20","134","139","20"
,"12","57","58","4","84","72","69","29","107","30","88","148","103","70"
,"37","135","55","30","153","134","27","11","165","160","2","96","31","3"
,"2","15","167","101","69","0","56","5","4","108","172","30","69","175","17"
,"25","155","5","121","117","49","113","136","72","85","191","53","119","103"
,"143","46","18","128","205","206","12","9","0","59");
#
# Example of using this data:
#
open (OUTPUT,">atom.gif")
       or die ("Couldn't create 'atom.gif'\n");
binmode(OUTPUT);       # ensure file written is unmolested
for $byte (@atom_gif) {
     printf(OUTPUT "%c", $byte);
}
close (OUTPUT);
#
-----------------chop-with-axe----------------chop-with-axe---------------------

Cheers!
-- 
Filip "I'll buy a vowel" Gieszczykiewicz  |  http://www.repairfaq.org/

                   Always and everything for the better!
 Now exploring whatever, life, and the meaning of it all... and 'not' :-)


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

Date: Tue, 22 Jun 1999 15:06:39 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: move file pointer?
Message-Id: <377008EF.25EC4D42@mail.cor.epa.gov>

bing-du@tamu.edu wrote:
> 
> Greetings all...,
> 
> I have a code snippet.  It prints out all those lines in the file that
> match the specific patterns.
> 
> foreach $pattern (@patterns)
> {
>    open(FILE, "file");
>    while (<FILE>)
>    {
>      if (/$pattern/)
>      { print $_;}
>     }
>     close(FILE);
> }
> My question is:
> Instead of opening and closing the file repeatedly, is there any way to
> let the file pointer point to the first line of the file for the next
> pattern checking?  Or any other better way for doing this?

Yes and yes.  Since you have posted here before, you'll 
probably feel quite embarrassed when you learn that this is
in the FAQ.

Look up this line in perlfaq6 [which I hope you're accessing
on your system instead of over the web]:
"How do I efficiently match many regular expressions at once?"

HTH,
David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 15:57:38 -0700
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: newbie PWS idiocy part 2
Message-Id: <Pine.GSO.4.02A.9906221556560.1698-100000@user2.teleport.com>

On Tue, 22 Jun 1999, Simon Ross wrote:

> I still can't get my scripts working on MS Personal Web Server.

Do you know where to find the docs, FAQs, and newsgroups about servers?

When you're having trouble with a CGI program in Perl, you should first
look at the please-don't-be-offended-by-the-name Idiot's Guide to solving
such problems. It's available on CPAN.

   http://www.perl.com/CPAN/
   http://www.perl.org/CPAN/
   http://www.perl.org/CPAN/doc/FAQs/cgi/idiots-guide.html
   http://www.perl.org/CPAN/doc/manual/html/pod/

Hope this helps!

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



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

Date: Tue, 22 Jun 1999 23:03:54 +0100
From: campbell-lange@easynet.co.uk (Barbara and Rory Campbell-Lange)
Subject: perl : use something like an applescript "property"
Message-Id: <campbell-lange-2206992303540001@campbell-lange.easynet.co.uk>


I'd like to store a text string in a Perl runtime application that can be
changed by the user and stored in the application rather than a
preferences file. I'm looking to do something similar to an applescript
"property'.

If this means reading and writing from the runtime file's resource fork
I'd be very grateful if someone could point me to an example.

Thank you to any replies!
Rory

--
Rory Campbell-Lange
The Campbell-Lange Workshop


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

Date: Tue, 22 Jun 1999 15:01:06 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
To: Andrea Busia <busia@tiscalinet.it>
Subject: Re: Perl Modules and Win98
Message-Id: <377007A2.7DAF1B99@mail.cor.epa.gov>

[courtesy cc sent to poster]

Andrea Busia wrote:
> 
> Someone know how to install a perl module on the activestate perl
> 5.00502 for win98? When I try to use the cgywin make for windows it
> gives me an error message like
> 
> Makefile:771 *** Missing Separator. Stop.

First, you should be using the ActiveState ppd files if they're
available.  If you want to check, use the ppm 'search' command.
[Read up on ppm in the HTML docs which come with AS Perl.]
Then use the ppm 'install' command to get the work done for you.

If you need to download a file from CPAN and install it, and
you need make, I would suggest that you use nmake, which is
free from the Microsoft website.  No, I'm not kidding.  Okay,
so I'm suggesting a Microsoft product in this newsgroup.  So 
sue me.  :-)

David
-- 
David Cassell, OAO                     cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician


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

Date: Tue, 22 Jun 1999 21:55:05 GMT
From: roberthp@my-deja.com
Subject: Re: Please help: Delete Reg Key with Sub-Keys.
Message-Id: <7kp0nj$lah$1@nnrp1.deja.com>

Thanks for the reply:

Necessity is driving my forays into registry editing with Perl,
unfortunately.  I was actually trained as a programmer quite a few
years ago, but I've been working as an MIS Manager and System
Administrator for the last 6 years: I've taken the necessary
precautions regarding my registry exploits.  :-)

I will definitely go check on the newsgroup you've mentioned, though,
because I wasn't aware there was a win32-centric group out there.

Thanks for the info.
Robert

In article <376FC241.BA236598@mail.cor.epa.gov>,
  David Cassell <cassell@mail.cor.epa.gov> wrote:
> [courtesy cc to poster]
>
> roberthp@my-deja.com wrote:
> >
> > Hello folks:
> >
> > I'm totally new to this Perl thing (just started today), and I'd
like
> > to figure out how to delete a registry key that has sub-keys.  The
key
> > I'm trying to delete is:
>
> Whoa!  Your first day with Perl and already you're risking
> your entire OS?  You're far braver than I am.  I highly
> recommend that your first programming task with a new language
> *not* be something which can cause major damage and even
> toast your machine.  Win32 registry damage can be nasty to
> repair, so please keep backup copies ready.
>
> That said, you might want to take your question to the
> Win32-Perl-users listserv, which is *very* win32-centric.
> Go to http://www.activestate.com/support/mailing_lists.htm
> to subscribe.  You could get your question answered in hours.
> It might even be a correct answer.
>
> > [SNIP]
> > Can anyone just give me a code snippet on how to delete a key with
sub-
> > keys, or point me to some code?  It *has* to be fairly straight-
> > forward, but not being a programmer is really hampering my ability
to
>                ^^^^^^^^^^^^^^^^^^^^^^
> > figure this out.
>
> Robert, now you're really making me worry.  Are you sure you
> don't want to start with some less risky tasks and work your
> way up?
>
> HTH,
> David
> --
> David Cassell, OAO                     cassell@mail.cor.epa.gov
> Senior computing specialist
> mathematical statistician
>


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.


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

Date: Tue, 22 Jun 1999 18:47:57 -0400
From: planb@newsreaders.com (J. Moreno)
Subject: Re: Statistics for comp.lang.perl.misc
Message-Id: <1dttdca.1ruwoag1kr4qlbN@roxboro0-0025.dyn.interpath.net>

Lee <rlb@intrinsix.ca> wrote:

> planb@newsreaders.com (J. Moreno) wrote:
> 
> >The more people that use the standard quoting style the easier it is to
> >convince newsreader authors that they should recognize that there /is/ a
> >standard.
> 
> I have some ODD (oppositional-defiant) friends who could give everyone here
> lessons on non-conventional newsreader configuration.

I don't think anybody needs lessons on non-conventional configurations,
unless it's as a negative example -- standard quoting is a Good Thing,
and lousy wrapping is an abomination in the sight of the gods.

-- 
John Moreno


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

Date: Tue, 22 Jun 1999 15:20:13 -0700
From: Bin Zeng <zeng@stat.Berkeley.EDU>
Subject: test
Message-Id: <Pine.SOL.4.10.9906221519560.11065-100000@witch.Berkeley.EDU>

perl




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

Date: 22 Jun 1999 22:56:53 GMT
From: Wells Scarsdale <revjack@radix.net>
Subject: Re: test
Message-Id: <7kp4bl$b3c$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight

Bin Zeng explains it all:

:perl

You forgot the -w switch.


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

Date: 22 Jun 1999 22:20:47 GMT
From: pdf@morgan.ucs.mun.ca (Paul David Fardy)
Subject: Re: time question
Message-Id: <7kp27v$99k$1@coranto.ucs.mun.ca>

Jimtaylor5 wrote:
>> I hope this is not really a dumb question, but I've been trying to
>> figure out how to get seconds from localtime (or anywhere) to
>> calculate how long a task takes. How would I get the time in
>> seconds from Perl, in order to say this task to 11 seconds or
>> whatever it took. I know how to calculate it, jut not how to get
>> the time in seconds. Can anyone help?

	$then = time;
	do_task();
	$now = time;    # Now is the time ...
	$elapsed_time = $now - $then;

srishti <srishti@vsnl.com> writes:
> You do not need to extract it from localtime, use time instead. It will
> give you number of seconds since 01-01-1970.

Ack!  What sort of notation is that?  Do you ever sort by time?
Is it painful? :-)

Actually, time() gives me the number of seconds since 1969-12-31.

Paul Fardy
-- 
 ... and time() won't give me time ...


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

Date: Tue, 22 Jun 1999 13:18:32 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: unable to create or rename files in subdirectories
Message-Id: <8hgok7.ia.ln@magna.metronet.com>

Rich G. (rg@fubar.net) wrote:
: JQ wrote in message <3772d2c9.41303568@news.cyberway.com.sg>...
: >I am unable to create or rename files that exist in subdirectories.
: >
: >Everything works fine if I create or rename files that are in the same
: >directory as my script:

: perldoc permissions



   No documentation found for "permissions".


What does it do on your system?


--
    Tad McClellan                          SGML Consulting
    tadmc@metronet.com                     Perl programming
    Fort Worth, Texas


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

Date: 12 Dec 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 Dec 98)
Message-Id: <null>


Administrivia:

Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing. 

]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body.  Majordomo will then send you instructions on how to confirm your
]subscription.  This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.

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

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