[11784] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5384 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 14 17:07:21 1999

Date: Wed, 14 Apr 99 14:00:32 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 14 Apr 1999     Volume: 8 Number: 5384

Today's topics:
    Re: accessing an array of subroutine references (Tad McClellan)
        Cookie problem jatgal@my-dejanews.com
    Re: Current Date <cassell@mail.cor.epa.gov>
    Re: DBI as a Base Module (Sys Adm 89806 Manager of programing development and Intranet Resources)
    Re: flocking question - worried (Daniel Beckham)
    Re: getting mm/dd/yy from localtime() (Larry Rosler)
    Re: getting mm/dd/yy from localtime() <Allan@due.net>
    Re: getting mm/dd/yy from localtime() <Allan@due.net>
    Re: HELP:  PERL construct (Larry Rosler)
    Re: how do I match all the "1"s in strings like 231451, (Larry Rosler)
    Re: how do I match all the "1"s in strings like 231451, (Bart Lateur)
    Re: how do I match all the "1"s in strings like 231451, (Bart Lateur)
        How to access Database in Perl ? <d951686@sftw.umac.mo>
    Re: How to access Database in Perl ? <yfang@gte.com>
    Re: How to prevent Ctrl-C from <STDIN>? (Daniel Beckham)
        Location target <dreas@email.com>
        Matching whole word <basvreek@xs5all.nl>
    Re: Matching whole word <yfang@gte.com>
    Re: Matching whole word <upsetter@ziplink.net>
    Re: Matching whole word (Larry Rosler)
    Re: Novice needs learning suggestions <emschwar@rmi.net>
    Re: Perl vs. OTHER scripting languages ? When/Why to us (Abigail)
    Re: problem with push (Larry Rosler)
    Re: send a mail with perl (Randal L. Schwartz)
    Re: Whats wrong with this? (Tad McClellan)
        Writing Binary Files mshntr@mta.ca
    Re: Writing Binary Files (Sam Holden)
        Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)

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

Date: Wed, 14 Apr 1999 10:00:48 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: accessing an array of subroutine references
Message-Id: <g272f7.7r6.ln@magna.metronet.com>

Ronny (ronald_f@my-dejanews.com) wrote:
: I have an array of sub references, like this:

:   @subs=(sub {do_this()}, sub {do_that()});

: Given an index $i, I would like to execute the subroutine at $subs[$i]. I
: tried

:   $result=&$subs[$i]();


    my $result = &{$subs[$i]}();


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


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

Date: Wed, 14 Apr 1999 19:48:49 GMT
From: jatgal@my-dejanews.com
Subject: Cookie problem
Message-Id: <7f2res$qm4$1@nnrp1.dejanews.com>

I'm trying to set a cookie, however I'm not being able to.
here is following what I'm doing

use CGI;

$query = new CGI;

$cookie = $query->cookie(-name =>'ID', -value => $ID);

print $query->header(-cookie=>$cookie);


any ideas why it might not be setting cookie. I also tried using
CGI::cookie  module  and other methods as

  print "Set-Cookie: name='cookiename'; value='cookievalue'; path='/';
  expires='time';\n";


Your help would be greatly appreciated


Thanks
J

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: Wed, 14 Apr 1999 13:03:51 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Current Date
Message-Id: <3714F4A7.9C7E5CC@mail.cor.epa.gov>

Sam Holden wrote:
> [snip] 
>
> But still you ask it in a perl newsgroup...
> 
> Do you do this a lot?
> 
> When you need some bread do you go to the optometrist and ask them
> for some? When you want a new hard drive do you go and ask the
> the McDonalds for one?

Sure I do.  It comes with a nice artificial-bread `bun' for padding, 
and is pre-lubricated with ketchup and mustard.  And the thing's
nearly indestructible too!

Why?  Where do you get your hard disks?

-- 
David Cassell, OAO                               
cassell@mail.cor.epa.gov
Senior Computing Specialist                          phone: (541)
754-4468
mathematical statistician                              fax: (541)
754-4716


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

Date: Wed, 14 Apr 1999 20:49:10 GMT
From: ruben@llinderman.dental.nyu.edu (Sys Adm 89806 Manager of programing development and Intranet Resources)
Subject: Re: DBI as a Base Module
Message-Id: <ab7R2.46$jD.1124@typhoon.nyu.edu>

[Posted and mailed]

Are you certain that I need to call use or require within a module when 
assigning the module to ISA?


Ruben


In article <3714bcba.0@newsread3.dircon.co.uk>,
	Jonathan Stowe <gellyfish@gellyfish.com> writes:
> In comp.lang.perl.misc Sys Adm 89806 Manager of programing development and Intranet Resources <ruben@llinderman.dental.nyu.edu> wrote:
>> 
>> I'm fairly perplexed at what is happening.  I tried to specifiy the path and    
>> diagnostics told me I didn't have permissions??
>> 
>> Without the path, it says it can't find any such module.
>> 
>> This small code, for example:
>> #!/usr/bin/perl -w
>> use SQLHANDLE;
>> use diagnostics; 
>> $ref = new SQLHANDLE('SELECT * FROM patients');
>> print $ref->statement();
>> $dbh = $ref->connect("DBI:mysql:ezpages:localhost", 'someuser','somepasswd') or 
>> print "Sorry DB DOWN";
>> 
>> Produces this output:
>> 
>>  /home/ruben/myootest.pl
>> Can't exec "DBI": No such file or directory at /usr/lib/perl5/SQLHANDLE.pm line 
>> 2.
>> Name "main::dbh" used only once: possible typo at /home/ruben/myootest.pl line
>>         6 (#1)
>>     
>>     (W) Typographical errors often show up as unique variable names.
>>     If you had a good reason for having a unique name, then just mention
>>     it again somehow to suppress the message.  The use vars pragma is
>>     provided for just this purpose.
>>     
>> SELECT * FROM patientsCan't locate object method "connect" via package "SQLHANDL
>> E" at
>>         /home/ruben/myootest.pl line 6 (#2)
>>     
>>     (F) You called a method correctly, and it correctly indicated a package
>>     functioning as a class, but that package doesn't define that particular
>>     method, nor does any of its base classes.  See perlobj.
>>     
>> Uncaught exception from user code:
>>         Can't locate object method "connect" via package "SQLHANDLE" at /home/ru
>> ben/myootest.pl line 6.
>> 
>> 
>> Any clues as to what I am doing wrong?
>> 
> 
> Have you got:
> 
> require DBI;
> @ISA = qw(DBI);
> 
> in your SQLHANDLE module ?
> 
> /J\


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

Date: Wed, 14 Apr 1999 16:34:44 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: flocking question - worried
Message-Id: <MPG.117ec5eb4cab3dc998968c@news.idt.net>

I'm not sure what type of database you are using, but could you use it to 
store the counter information?  Since most database engines already 
account for similtaneous read/writes, why not let it do the work for you?  
Create a new table with an int field in it and increment the number 
everytime you need to... locking issues solved...

Daniel

In article <3709cc2e.0@glitch.nildram.co.uk>, c-denman@dircon.co.uk 
says...
> Hi group,
> 
> Something is playing on my mind, and I hope someone out there can put my
> mind at rest.
> 
> I have a simple counter file, which increases by one, and can be increased
> by anyone at any time.
> 
> The flocking side of things is not a problem, I am just worried what happens
> when a file is locked and the server crashes before the file is unlocked.
> 
> Will this file be forever locked, making that file not accessible -
> effectively 'crashing' the whole file incrementing proceedure?
> 
> Comments would be greatly appreciated.
> 
> ChrisD
> 
> 
> 


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

Date: Wed, 14 Apr 1999 13:13:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: getting mm/dd/yy from localtime()
Message-Id: <MPG.117e96da8c71827c9898b4@nntp.hpl.hp.com>

In article <xkfaewbm3ct.fsf@valdemar.col.hp.com> on 14 Apr 1999 13:03:30 
-0600, Eric The Read <emschwar@rmi.net> says...
> "Allan M. Due" <Allan@due.net> writes:
> > What they hey, here you go.  Adding 0s if needed left as an exersize for the
> > poster.
> > 
> > my $date = join('/',map{$i++;$i==1?$_+1:$_}(localtime)[4,3,5]);
> 
> No.
> 
> perldoc -f localtime to find out why.
> 
> Hint: what's that going to print out next year?

Double-yuck.  As Allan says, it doesn't zero-pad to two digits, either.  
Neither does my substr suggestion, with I withdraw in favor of the other 
suggestion, sprintf.

Instead of continuing to dance around the 'Read the docs, Luke' stuff:

    my ($day, $month, $year) = (localtime)[3 .. 5];
    sprintf '%.2d/%.2d/%.2d', $month + 1, $day, $year % 100;

I think that's appeared in this newsgroup a zillion times.

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


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

Date: Wed, 14 Apr 1999 16:31:33 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: getting mm/dd/yy from localtime()
Message-Id: <7f2thv$39a$1@camel18.mindspring.com>

Eric The Read wrote in message ...
:"Allan M. Due" <Allan@due.net> writes:
:> What they hey, here you go.  Adding 0s if needed left as an exersize for
the
:> poster.
:>
:> my $date = join('/',map{$i++;$i==1?$_+1:$_}(localtime)[4,3,5]);
:No.
:perldoc -f localtime to find out why.


Well, ok.  It was really just supposed to be fun and hopefully illustrative,
not a final solution but you are correct, I should have put more warnings
into my message.  Definitely not y2k complient <g>. Might as well do the
whole thing then.  Seems like a lot of work though.  Someone must have a
better version.  Given that I want this to work under use strict, the thing
I don't like is the $i.  I can't use my $i in the map because that resets it
everytime.  I don't want it to be global so the only thing I can think of
is:

{my $i;
my $date =
join('/',map{$i++;sprintf("%02d",substr($i==1?$_+1:$_,-2,2))}(localtime)[4,3
,5]);
}

But then it is not a oneliner so that bums me out.  Well, I have work to do.
I'll try again later.


AmD
--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
And don't tell me there isn't one bit of difference between null and space,
because that's exactly how much difference there is.  :-)
 - Larry Wall in <10209@jpl-devvax.JPL.NASA.GOV>





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

Date: Wed, 14 Apr 1999 16:43:25 -0400
From: "Allan M. Due" <Allan@due.net>
Subject: Re: getting mm/dd/yy from localtime()
Message-Id: <7f2u88$l35$1@camel21.mindspring.com>

Ok, just rereading that and the stupid brackets are just plain stupid.  Why
are my last ideas always the worst.  Jeez.  Anyway, after reading Larry's
comment I just have to say: 1) I believe that my fixation with oneliners is
a developmental stage that I will probably out grow and 2)  Clearer really
is better <g>.

AmD

--
$email{'Allan M. Due'} = ' All@n.Due.net ';
--random quote --
echo "ICK, NOTHING WORKED!!!  You may have to diddle the includes.";
 - Larry Wall in Configure from the perl distribution






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

Date: Wed, 14 Apr 1999 13:28:49 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: HELP:  PERL construct
Message-Id: <MPG.117e9a5a75f3f9609898b5@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <3714E6C3.F76C58F1@gotmail.eng.sun.com> on Wed, 14 Apr 1999 
12:04:35 -0700, durai <durai@gotmail.eng.sun.com> says...
> Hi,
> 
> I am trying to get the equivalent of the following in perl..
> 
> nawk "/COMMENT_BEGIN/,/COMMENT_END/" $1  
> 
> This will return the lines between the two tags inclusive.

In a Perl program:

/COMMENT_BEGIN/ ... /COMMENT_END/ and print while <>;

>From the command line:

perl -ne "print if /COMMENT_BEGIN/ ... /COMMENT_END/" file1 file2 ...

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


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

Date: Wed, 14 Apr 1999 13:39:11 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: how do I match all the "1"s in strings like 231451,3132414131,etc?
Message-Id: <MPG.117e9cc688a6c24b9898b6@nntp.hpl.hp.com>

In article <7f2r84$b4o$2@client2.news.psi.net> on 14 Apr 1999 19:45:08 
GMT, Abigail <abigail@fnx.com> says...
> SAM (same@minspring.com) wrote on MMLII September MCMXCIII in
> <URL:news:7f2kkt$4ub$1@camel29.mindspring.com>:
> .. How do I match a minimum of 2  and a maximum of 4 "1"s in strings like
> .. 2312312134
> .. 56132141313416512
> 
>     /^(?:[^1]*1){2}(?:[^1]*1){,2}[^1]*$/

My day (week, month, year?) is made!  I got it more concise than 
Abigail.  Will wonders never cease?

      /^(?:[^1]*1){2,4}[^1]*$/

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


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

Date: Wed, 14 Apr 1999 20:48:24 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: how do I match all the "1"s in strings like 231451,3132414131,etc?
Message-Id: <3714fd04.6483237@news.skynet.be>

SAM wrote:

>How do I match a minimum of 2  and a maximum of 4 "1"s in strings like
>2312312134
>56132141313416512
>
>I used the following re
>
>$String =~ /[1]{2,4}/g;
>
>but this seem to match only successive occurances of "1"s.

You want to COUNT the number of ones? Then don't use a regex.

	tr/1//

This does nothing to the string, but counts the number of occurences.
So:

  while(<DATA>) {
	print;
	my $count = tr/1//;
	if($count>=2 and $count<=4) {
		print "Got a match! ($count)\n";
	} else 
		print "No match... ($count)\n";
	}
  }
__DATA__
2312312134
56132141313416512

->
 2312312134
 Got a match! (3)
 56132141313416512
 No match...(6)


	Bart.


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

Date: Wed, 14 Apr 1999 20:54:43 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: how do I match all the "1"s in strings like 231451,3132414131,etc?
Message-Id: <37160027.7286789@news.skynet.be>

Bart Lateur wrote:

>>$String =~ /[1]{2,4}/g;
>>
>>but this seem to match only successive occurances of "1"s.
>
>You want to COUNT the number of ones? Then don't use a regex.
>
>	tr/1//

I just remembered: you can count occurences of suibstrings using regexes
too:

    $count = ()= /1/g;
    print "[$count]\n";

The " = () = " is a trick, which show a list context to the regex, while
the count of the result (list of every match) is stored into the scalar
variable.

	Bart.


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

Date: Thu, 15 Apr 1999 02:56:42 +0800
From: "Chow Hoi Ka, Eric" <d951686@sftw.umac.mo>
Subject: How to access Database in Perl ?
Message-Id: <3714E4E9.DD886B78@sftw.umac.mo>

Hello,

Is it possible to access Database in Perl ?
Such as, Oracle, Sybase, Ms Access, DBF file.

Is it is possible, how ? Would you please to give me a simple example
???

Best regards,
Eric

--
     _                                                  _
    / ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
   / /  |                                            |  \ \
 _( /_  | _   Chow Hoi Ka, Eric                    _ |  _) )_
(((\ \> |/ )                                      ( \| </ /)))
(\\\\ \_/ /   E-Mail : d951686@sftw.umac.mo        \ \_/ ////)
 \       /                                          \        /
  \    _/     http://www.sftw.umac.mo/~d951686/      \_     /
  /   / |____________________________________________| \    \
 /   /                                                   \    \




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

Date: Wed, 14 Apr 1999 16:35:08 -0400
From: Yu Fang <yfang@gte.com>
Subject: Re: How to access Database in Perl ?
Message-Id: <3714FBFC.6531478D@gte.com>

try this: http://www.symbolstone.org/technology/perl/DBI/index.html

"Chow Hoi Ka, Eric" wrote:
> 
> Hello,
> 
> Is it possible to access Database in Perl ?
> Such as, Oracle, Sybase, Ms Access, DBF file.
> 
> Is it is possible, how ? Would you please to give me a simple example
> ???
> 
> Best regards,
> Eric
> 
> --
>      _                                                  _
>     / ) |~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| ( \
>    / /  |                                            |  \ \
>  _( /_  | _   Chow Hoi Ka, Eric                    _ |  _) )_
> (((\ \> |/ )                                      ( \| </ /)))
> (\\\\ \_/ /   E-Mail : d951686@sftw.umac.mo        \ \_/ ////)
>  \       /                                          \        /
>   \    _/     http://www.sftw.umac.mo/~d951686/      \_     /
>   /   / |____________________________________________| \    \
>  /   /                                                   \    \

--


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

Date: Wed, 14 Apr 1999 16:43:15 -0500
From: danbeck@scott.net (Daniel Beckham)
Subject: Re: How to prevent Ctrl-C from <STDIN>?
Message-Id: <MPG.117ec7efcc14e30e98968e@news.idt.net>

The perl docs and faq have that info, but you might be interested in the 
Perl Cookbook published by www.ora.com.  It's a great reference and 
explains how to do just that and more.

Daniel

In article <370A1895.FC7F74E5@mail.nwos.lucent.com>, 
fuchin@mail.nwos.lucent.com says...
> Hi, how can we prevent users from using CTRL-C to quit perl program when
> it is
> waiting for users' input from <STDIN>?
> 
> 


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

Date: Wed, 14 Apr 1999 21:42:22 +0200
From: "Dreas van Donselaar" <dreas@email.com>
Subject: Location target
Message-Id: <7f2r41$1q7$1@news.quicknet.nl>

Is it possibvle to specify a target when I use location?

Please email me at dreas@email.com





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

Date: Wed, 14 Apr 1999 22:15:42 +0200
From: "Bas van Reek" <basvreek@xs5all.nl>
Subject: Matching whole word
Message-Id: <7f2t0e$6ho$1@weber.a2000.nl>



How do i match a whole word.

It should match " blah " and "blah" and "blah " and " blah"
but not "xxblahxx"





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

Date: Wed, 14 Apr 1999 16:32:31 -0400
From: Yu Fang <yfang@gte.com>
Subject: Re: Matching whole word
Message-Id: <3714FB5F.305C8176@gte.com>

do you mean /\s+blah\s+/ ?

Bas van Reek wrote:
> 
> How do i match a whole word.
> 
> It should match " blah " and "blah" and "blah " and " blah"
> but not "xxblahxx"

-- 
Frank Yu Fang 

GTE Internetworking
40 Sylvan Road
Waltham, MA 02451-1128

Phone: 781-262-7274  
Fax: 781-466-2650
Pager: 1-800-759-8888 PIN# 1619895 or 1619895@skytel.com


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

Date: Wed, 14 Apr 1999 20:39:38 GMT
From: Scratchie <upsetter@ziplink.net>
Subject: Re: Matching whole word
Message-Id: <e27R2.631$Ij2.70503@news.shore.net>

Yu Fang <yfang@gte.com> wrote:
: do you mean /\s+blah\s+/ ?

I think he wants /\bblah\b/ .

--art

: Bas van Reek wrote:
:> 
:> How do i match a whole word.
:> 
:> It should match " blah " and "blah" and "blah " and " blah"
:> but not "xxblahxx"

: -- 
: Frank Yu Fang 

: GTE Internetworking
: 40 Sylvan Road
: Waltham, MA 02451-1128

: Phone: 781-262-7274  
: Fax: 781-466-2650
: Pager: 1-800-759-8888 PIN# 1619895 or 1619895@skytel.com

-- 
--------------------------------------------------------------------------
                    National Ska & Reggae Calendar
                  http://www.agitators.com/calendar/
--------------------------------------------------------------------------


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

Date: Wed, 14 Apr 1999 13:54:34 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Matching whole word
Message-Id: <MPG.117ea062ec12aa869898b8@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7f2t0e$6ho$1@weber.a2000.nl> on Wed, 14 Apr 1999 22:15:42 
+0200, Bas van Reek <basvreek@xs5all.nl> says...
> How do i match a whole word.
> 
> It should match " blah " and "blah" and "blah " and " blah"
> but not "xxblahxx"

Look in perlre for the \b (word boundary) assertion.  Of course, one can 
get into a debate about "what's" a word...

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


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

Date: 14 Apr 1999 14:22:16 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: Novice needs learning suggestions
Message-Id: <xkf4smjlzpj.fsf@valdemar.col.hp.com>

Ala Qumsieh <aqumsieh@matrox.com> writes:
> If by "couple" you mean "several", then you are wrong again, as my
> webster dictionary defines "couple" as:
> 
> 	2. Two of the same kind connected or considered together; a
> 	   pair; a brace. 

Get a better dictionary. :^)

>From <URL:http://www.m-w.com/dictionary.htm> (essentially, MWCD10):

4 : an indefinite small number : FEW <a couple of days ago> 

> yeah yeah .. I am a pain in the butt sometimes :-)

That's okay, I've been wrong a time or two myself. :-)

-=Eric


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

Date: 14 Apr 1999 20:07:30 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Perl vs. OTHER scripting languages ? When/Why to use it ?
Message-Id: <7f2si2$bfi$1@client2.news.psi.net>

Michael Genovese (mikeg@slpmbo.ed.ray.com) wrote on MMLII September
MCMXCIII in <URL:news:3714AC6C.967940A5@slpmbo.ed.ray.com>:
[] Hello:
[] 
[] I've been asked by my manager to come up with reasons, arguments,
[] and/or guidelines for choosing one scripting language over another.
[] 
[] Our group is a modest-sized TOOLS group in a large company.
[] We have scripts in the following :
[] 
[]         * AWK (and NAWK)
[]         * C SHELL
[]         * KORN SHELL
[]         * PERL
[]         * TCL
[] 
[] I'm a PERL fan.
[] I know C SHELL a bit, but find PERL much easier to handle.
[] 
[] My manager is definately a C SHELL fan, doesn't know PERL and doesn't
[] really have the time to learn it.  In point of fact, he's a C SHELL expert.
[] 
[] He recently decided that we WILL do our scripts in C-SHELL & AWK/NAWK,
[] but is now willing to modify his position if I can come up with
[] compelling arguments to do otherwise.
[] 
[] Suggestions, people ?
[] 
[] I'm not saying PERL should be used for ALL scripts.
[] But I do think that any script of any size and/or complexity is
[] probably better off in PERL than in C-SHELL and/or AWK/NAWK.


Ask him to write a short script that fetches a Web page from the
Internet, and stores it in a database.

In 20 lines tops. Let him measure the time to develop such a program.



Abigail
-- 
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'


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

Date: Wed, 14 Apr 1999 13:48:32 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: problem with push
Message-Id: <MPG.117e9efe5ec257309898b7@nntp.hpl.hp.com>

[Posted and a courtesy copy mailed.]

In article <7f2pgq$1pj$1@nntp2.uunet.ca> on Wed, 14 Apr 1999 15:15:03 -
0400, Elliot Slater <eslater@frinc.com> says...
> Here is code snipet:
> $MckShared  = "c:\perl\modules\";
> $_ = "$MckShared";
> s/\\/\\\\/g;
> $MckShared = $_;
> 
> push(@INC, $MckShared);
> 
> Problem is it is not finding the module in the MckShared directory and the
> script wont compile.  I cant figure it out.  I look in a Perl Book I have
> and the push looks identical.
> 
> Any help is appreciated.

Of course it won't compile.  See the backslash ahead of what you think 
is the closing double-quote in the first line?  (And the other 
backslashes are bogus too.)

Use forward slashes (best), single-quotes (OK, I guess), or doubled 
backslashes (worst).  Then try again.

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


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

Date: 14 Apr 1999 13:37:49 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: send a mail with perl
Message-Id: <m1u2uj0wgy.fsf@halfdome.holdit.com>

>>>>> "Kevin" == Kevin  <mpajot@club-internet.fr> writes:

Kevin> open (MAIL, "| mail toto@here.com -s any_subject");
Kevin> print MAIL "coucou";
Kevin> close (MAIL);

Why do you have an unescaped "@" in a double-quoted string?
Why are you using /bin/mail?

Kevin> Is there any reason?

There is no reason. :)

Kevin> Could you give me an other solution to send email with the
Kevin> receiver and the suject in the command line...

Sure, but it's probably easier to find it in the FAQ (* already on
your disk *) rather than making me quote it.

print "Just another Perl hacker,"

-- 
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me


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

Date: Wed, 14 Apr 1999 10:06:09 -0400
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Whats wrong with this?
Message-Id: <hc72f7.7r6.ln@magna.metronet.com>

billy_collins@my-dejanews.com wrote:

: Hi all, can someone tell me whats wrong with this code!


   Try this from the command line:


man pico >pico.man

Then pull pico.man into an editor.

What's it look like?



man(1) makes funny output...


: #!/usr/local/bin/perl5
: $n = `man pico`;

#!/usr/local/bin/perl5 -w
use strict;                   # always use strict and enable warnings!
my $n = `man pico | col -b`;  # maybe this will be better...



: Is it that the output of UNIX command cannot be printed? But then, instead of
: having 'man pico' if I have 'ping www.yahoo.com' (which is a UNIX command as
: well), it works!

: Or is it that the server does not permit such a thing or something?


   It is the formatting codes that man applies, perhaps.


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


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

Date: Wed, 14 Apr 1999 20:22:14 GMT
From: mshntr@mta.ca
Subject: Writing Binary Files
Message-Id: <7f2tdc$smf$1@nnrp1.dejanews.com>

Hi,
I'm trying to write to a file, but I want to write binary not Ascii.  Here's
what I've tried(both result in the ASCII rep of the decimal value of $loca_sig
to be saved...)(ps - this is running on a dos based machine, hence binmode):

#Attempt1
open(ZIP,">outfile.zip");
binmode ZIP;
binmode STDOUT;
$local_sig=0x04034b50;
printf ZIP $local_sig;
close(ZIP);


#Attempt 2
open(ZIP,">outfile.zip");
binmode ZIP;
binmode STDOUT;
$local_sig=0x04034b50;
printf ZIP ("%u",$local_sig);
close(ZIP);

Thanks,
-=Matt=-

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    


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

Date: 14 Apr 1999 20:44:06 GMT
From: sholden@pgrad.cs.usyd.edu.au (Sam Holden)
Subject: Re: Writing Binary Files
Message-Id: <slrn7h9vgm.of2.sholden@pgrad.cs.usyd.edu.au>

On Wed, 14 Apr 1999 20:22:14 GMT, mshntr@mta.ca <mshntr@mta.ca> wrote:
>Hi,
>I'm trying to write to a file, but I want to write binary not Ascii.  Here's
>what I've tried(both result in the ASCII rep of the decimal value of $loca_sig
>to be saved...)(ps - this is running on a dos based machine, hence binmode):

perldoc -f pack

-- 
Sam

So I did some research. On the Web, of course. Big mistake...
	--Larry Wall


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

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

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