[18108] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 268 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Feb 11 06:05:31 2001

Date: Sun, 11 Feb 2001 03:05:08 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981889508-v10-i268@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sun, 11 Feb 2001     Volume: 10 Number: 268

Today's topics:
    Re: *perl newbie* asking for hash-of-hashes basics (John Joseph Trammell)
    Re: A Question on OLE and EXCEL- help please <csh_news@henktech.x-cut-x.com>
        Array printing <aidounif@club-internet.fr>
    Re: Array printing (Gwyn Judd)
    Re: Array printing <bart.lateur@skynet.be>
    Re: Builing INSERT-statement from hash <rick.delaney@home.com>
    Re: chown not allowed <bart.lateur@skynet.be>
    Re: get and https <rick.delaney@home.com>
        having problem with installing modules <ahmedj@my-deja.com>
    Re: having problem with installing modules (Gwyn Judd)
    Re: Modules/Constants. (Martien Verbruggen)
    Re: NDBM_File and ndbm.h (Garry Williams)
    Re: Newbie to perl... <kstep@pepsdesign.com>
        ODBC PERFORMANCE PROBLEM <ja@nee.snee>
    Re: Radical readdir suggestion <ldo@geek-central.gen.new_zealand>
    Re: Radical readdir suggestion (Martien Verbruggen)
        Real userID? Effective UserID? <leekembel@hotmail.com>
    Re: Real userID? Effective UserID? (Martien Verbruggen)
    Re: Sending email from Perl Script on NT <wyzelli@yahoo.com>
    Re: split a path and keep the slashes? (Craig Berry)
    Re: undef ? <kstep@pepsdesign.com>
    Re: undef ? <bart.lateur@skynet.be>
    Re: UNIX core dumps - Segmentation Fault (Honza Pazdziora)
    Re: Wanted: Perl Programmer for Chatologica Metasearch  (David H. Adler)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Sun, 11 Feb 2001 06:16:24 GMT
From: trammell@bayazid.hypersloth.net (John Joseph Trammell)
Subject: Re: *perl newbie* asking for hash-of-hashes basics
Message-Id: <slrn98c9g4.hci.trammell@bayazid.hypersloth.net>

On Fri, 9 Feb 2001 18:12:40 -0800, Dennis Wilson <lincwils@teleport.com> wrote:
> Perl is such a wonderful tool.  What you have discovered is that
> there is a shorthand for reference notation. Randall Schwarz has explained
> it beautifully in some of his articles. I think they are viable on his web
> site at stonehenge.com.
> 
> If I declare the following:
> 
> my %h1 = {}
> $h1{'KEY1'} = ( "one" => "uno", "two" => "dos");

Cripes, that doesn't even *parse*, much less do anything useful.



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

Date: Sat, 10 Feb 2001 20:51:39 -0700
From: Charles Henkel <csh_news@henktech.x-cut-x.com>
Subject: Re: A Question on OLE and EXCEL- help please
Message-Id: <s03c8togavo08q87q58s299mof7mtr6358@4ax.com>

On Fri, 09 Feb 2001 19:34:57 GMT, dog222@my-deja.com wrote:

>Hello all Perl stud and studettes out there.
>I have been learning Perl using the Coriollis"PERL Core Language Little
>Black Book" and all of their scripts have been correct so far and now
>it seems one of them is not working on my computer (I have NT).  I am
>using ActivePerl to run a simple OLE program to use EXCEL but I keep
>getting and error.
>What follows is the simple script and afterwords I post the error.
>Can anyone tell me what is wrong with this script?
>I thank you in advance!!!!
>
>
>use OLE;
>$operand1 = '2';
>$operand2 = '2';
>$excelobject = CreateObject OLE 'Excel.Sheet';
>$excelobject->Cells(1,1)->{value}=$operand1;
>$excelobject->Cells(2,1)->{value}=$operand2;
>$excelobject->Cells(3,1)->{formula}='=R1C1 + R2C1';
>$sum = $excelobject->Cells(3,1)->{Value};
>$excelobject->Quit();
>print "According to Microsoft Excel, ","$operand1 + $operand2
>
>=$sum.\n";
>
>
>
>ERROR MESSAGE!!!!!!
>
>"Cant use and undefined value as a hash reference at line 5."
>
>
>Sent via Deja.com
>http://www.deja.com/

CreateObject('Excel.Sheet') returns a ref to an Excel Workbook object,
not at Worksheet object, as of, I think, Excel 97.


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

Date: Sun, 11 Feb 2001 01:04:50 -0000
From: "Frédéric Aidouni" <aidounif@club-internet.fr>
Subject: Array printing
Message-Id: <964l4u$553$1@front6.grolier.fr>

Hi!

could someone tell me why

my @tab=("123", "abc");

print "@tab";

prints 123 abc
with a space between 123 abd abc

and

print @tab;

prints 123abc
without space?!

tia!





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

Date: Sun, 11 Feb 2001 07:30:25 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Array printing
Message-Id: <slrn98cfsg.32r.tjla@thislove.dyndns.org>

I was shocked! How could Frédéric Aidouni <aidounif@club-internet.fr>
say such a terrible thing:
>Hi!
>
>could someone tell me why
>
>my @tab=("123", "abc");
>
>print "@tab";
>
>prints 123 abc
>with a space between 123 abd abc

See the perlvar manual page. Look for the variable called $"

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
A conservative is a man who believes that nothing should be done for
the first time.

		-- Alfred E. Wiggam


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

Date: Sun, 11 Feb 2001 10:42:33 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Array printing
Message-Id: <n1rc8t0piv7flffoe9c3u65s7db67lcq23@4ax.com>

Gwyn Judd wrote:

>>could someone tell me why
>>
>>my @tab=("123", "abc");
>>
>>print "@tab";
>>
>>prints 123 abc
>>with a space between 123 abd abc
>
>See the perlvar manual page. Look for the variable called $"

And don't forget to mention $, .

Note top the OP:

	print @tab

does the same as

	print join($, , @tab)

(it appends $\ to the output string as well), where the default value of
$, is undef; and no, you won't get a warning.

By contrast, 

	print "@tab"

does the same as

	print join($" , @tab)

Same functionality, different variable. The default value for $" is a
space.

-- 
	Bart.


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

Date: Sun, 11 Feb 2001 03:54:50 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: Builing INSERT-statement from hash
Message-Id: <3A861049.8A3ECCB2@home.com>

Mark Jason Dominus wrote:
> 
>         my $sth = $dbh->prepare(qq|INSERT INTO tbl
>                                    ($FIELDS) VALUES ($QQQ)|);
>         for my $hash (@hashes) {  # $hash is one hashref as in your example
>           $sth->execute(@{$hash}(@fields));
>         }
> 
> This assumes that every $hash has all the fields; if not you have to
> add some extra processing to turn the Perl 'undef' values into the
> 'NULL' that SQL expects.

DBI will do that processing for you, i.e. the undef values for the
non-existant hash values will be inserted as NULLs.

Extra processing would be necessary if you wanted fields not in the hash
to get inserted with their default values (if supported by the database)
as they would if the fields were unmentioned in the SQL.

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sun, 11 Feb 2001 10:21:19 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: chown not allowed
Message-Id: <q4pc8ts2i84fj6r6mipepas0iaa7bggoc6@4ax.com>

Chris Fedde wrote:

>Readers should also get a shared lock on 'visible' while they are
>reading it to prevent writers from gaining the exclusive lock till they
>are all done reading it.  

That is precisely the situation I was trying to avoid. If I need to do
this, then I might just as well sick to one single file for reading and
writing? Or not?

I'm beginning to think it's not worth the bother. So the new version of
the file has another owner. So what? It *is* annoying at times, for
example, replacing an updated file with a backup from tar, that will
complain that it cannot change permissions.

>If you are running under apache it might be worth while looking at the
>suEXEC configuration so that your CGI programs can run as someone other
>than the www user.  But that is a topic for a different news group.

That's another approach I thought about: a simple SUID program in C that
does nothing but create a file under the right user, with the right file
permissions. I could even pipe the data to write into it, but I don't
think it's really necessary.

-- 
	Bart.


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

Date: Sun, 11 Feb 2001 04:00:37 GMT
From: Rick Delaney <rick.delaney@home.com>
Subject: Re: get and https
Message-Id: <3A8611A8.8259F146@home.com>

[posted & mailed]

"Tulan W. Hu" wrote:
> 
> I'm trying to use LWP to get a file content via proxy server and https.
> The following code works without a proxy; however, it fails if I am trying
> to ge a page out side of proxy server.

[snip]

> $ua->proxy(['http', 'ftp'], 'https://my.proxy.com:8000/');
             ^^^^^^^^^^^^^^^

Just a guess, but shouldn't 'https' be in that array ref?

-- 
Rick Delaney
rick.delaney@home.com


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

Date: Sun, 11 Feb 2001 07:01:18 GMT
From: Pakman <ahmedj@my-deja.com>
Subject: having problem with installing modules
Message-Id: <965dbt$f7e$1@nnrp1.deja.com>

Hi,

I have perl 5.0.6 installed, it came with red hat 7.0.  I am trying to
install perl DBI module.  i downloaded it, tarred it and than went into
the newly created directory and type perl Makefile.pl.  That worked fine
and a Makefile was created.  But now that I type make, it says make not
found. Why is this happening.  I checked all over the internet and this
is what needs to be done to install modules.  Is there any way around
this, like just copying the files into the perl directory?



Sent via Deja.com
http://www.deja.com/


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

Date: Sun, 11 Feb 2001 07:33:05 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: having problem with installing modules
Message-Id: <slrn98cg1g.32r.tjla@thislove.dyndns.org>

I was shocked! How could Pakman <ahmedj@my-deja.com>
say such a terrible thing:
>Hi,
>
>I have perl 5.0.6 installed, it came with red hat 7.0.  I am trying to
>install perl DBI module.  i downloaded it, tarred it and than went into
>the newly created directory and type perl Makefile.pl.  That worked fine
>and a Makefile was created.  But now that I type make, it says make not
>found. Why is this happening.  I checked all over the internet and this
>is what needs to be done to install modules.  Is there any way around
>this, like just copying the files into the perl directory?

When it says "make not found" what this is saying to you is that the
"make" utility is not installed. make is not part of Perl it is a
separate thing so you need to install it separately.

-- 
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
"Mine is not a celestial state"
 with idle hymns of praise"
  [Eddie Vedder, "Angel"]
  Atheism/Freethought fortune cookie file


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

Date: Sun, 11 Feb 2001 16:17:10 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Modules/Constants.
Message-Id: <slrn98c82m.vht.mgjv@martien.heliotrope.home>

On 11 Feb 2001 00:40:19 GMT,
	Abigail <abigail@foad.org> wrote:
> Martien Verbruggen (mgjv@tradingpost.com.au) wrote on MMDCCXX September
> MCMXCIII in <URL:news:slrn98bh2i.vht.mgjv@martien.heliotrope.home>:
> ?? On Fri, 09 Feb 2001 00:48:54 +0000,
> ?? 	Kelly Dorset <dorsettest@uk.insight.com> wrote:
> ?? > 
> ?? > ok.  starting with the constants file (pebbleconst.pm): 
> ?? 
> ?? I haven't run your code, but one thing to notice:
> ?? 
> ?? > sub BEGIN {  
> ?? 
> ?? ITYM
> ?? 
> ?? BEGIN {
> ?? }
> ?? 
> ?? without the sub.
> 
>     sub BEGIN { ... }
> 
> is entirely correct. The keyword 'sub' is optional.

So it is. I stand corrected.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd.   | from a rich salesperson.
NSW, Australia                  | 


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

Date: Sun, 11 Feb 2001 02:50:54 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: NDBM_File and ndbm.h
Message-Id: <i6nh6.2380$OO2.16985@eagle.america.net>

On Sat, 10 Feb 2001 21:26:10 GMT, Costin <tanase_costin@my-deja.com> wrote:
> I create a data base with perl 5.005_03 using NDBM_File. When I try to
>read it with a C program using ndbm.h I obtain  garbage.
                                         ^^^^^^^^^^^^^^^
I wonder what that means? 

> Could please someone tell me if this is something I should expect?

Maybe you should tell what _you_ expect.  

> Did anybody used ndbm files with perl and C and it worked?

Yes.  

> I run Solaris 8 on a sparc10,

Interesting.  

It's impossible to tell what the problem is without code.  

You need to post _suitably trimmed_ Perl code.  You need to explain
what you expected and what you observed.  

-- 
Garry Williams


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

Date: Sat, 10 Feb 2001 21:39:31 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: Newbie to perl...
Message-Id: <964tvo$ge9$1@slb7.atl.mindspring.net>

"fail006" <fail00@hotmail.com> wrote in message
news:964k8f$91g$3@lust.ihug.co.nz...
> Hi,
> I would like write a small program in perl that will tell me the IP
address
> of my local machine....I am using redhat 7...
> How do i go about this...?
>
> Thanks

First off, please use a subject line that describes your question.  The
regulars in this group are unlikely to read a post titled 'Newbie to
perl...', much less provide an answer.  'How do I determine the IP address
of my local machine?' would be more to the point.  Besides, why should we
care about your experience level?  For all we know, you could be a text
munging Perl guru who never had the occasion to look up their own IP address
before.

Of course, if you were a text munging Perl guru, you would probably know
your way through the documentation well enough to figure it out yourself....

First off, let's try the FAQ.  Typing 'perldoc -q "ip address"' yields the
following code snippet:

<< BEGIN CODE - 1ST TRY >>

use strict;

# From the FAQ
use Socket;
use Sys::Hostname;
my $host = hostname();
my $addr = inet_ntoa(scalar gethostbyname($host || 'localhost'));

# Check the result....
print $addr;

<< END CODE >>

This gives me my LAN address, but I knew that already.  (Actually, I'm not
on a network.  My development box is configured with a crazy multi-homed
scheme through the NT 'loopback adapter' so that all my local IP addresses
correspond to the same physical machine.)

This gets me curious - How do I find the IP address of my PPP dialup
connection?  All internet connections use sockets, so if I connect to a
remote machine, I can check the socket for the local IP address.  Looking up
the 'socket' function in perlfunc doesn't tell me much, except to 'See the
examples in Sockets: Client/Server Communication in the perlipc manpage.'
Slightly rearanging the sample code form perlipc, I connect a socket to my
ISP (since I know that they're alive).

<< BEGIN CODE - 2ND TRY >>

use strict;
use Socket;

my $remote = 'mindspring.com';
my $port = 80;

my $iaddr   = inet_aton($remote) or die "no host: $remote";
my $paddr   = sockaddr_in($port, $iaddr);
my $proto   = getprotobyname('tcp');

socket(SOCK, PF_INET, SOCK_STREAM, $proto) or die "socket: $!";
connect(SOCK, $paddr) or die "connect: $!";

my $mysockaddr = getsockname(SOCK);
my ($myport, $myaddr) = sockaddr_in($mysockaddr);

printf "Connected to %s [%s]\n",
    scalar gethostbyaddr($myaddr, AF_INET),
    inet_ntoa($myaddr);

close(SOCK) or die "close: $!"

<< END CODE >>

This prints:

Connected to user-2ive2i7.dialup.mindspring.com [165.247.10.71]

That's exactly what I wanted to know, but it took an awful lot of work to
get there.  Maybe a module like IO::Socket could save me some typing.  After
cutting and pasting some sample code I wind up with this:

<< BEGIN CODE - 3RD ONE'S A KEEPER >>

use strict;
use IO::Socket::INET;
use Socket;

my $sock = new IO::Socket::INET(PeerAddr => 'mindspring.com',
                                PeerPort => 'http(80)',
                                Proto    => 'tcp') or die "Socket: $!";

my $addr = $sock->sockaddr();

printf "Connected to %s [%s]\n",
    scalar gethostbyaddr($addr, AF_INET),
    inet_ntoa($addr);

$sock->close or die "Close: $!";

<< END CODE >>

HTH,

Kurt Stephens





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

Date: Sun, 11 Feb 2001 11:53:59 -0800
From: "Me" <ja@nee.snee>
Subject: ODBC PERFORMANCE PROBLEM
Message-Id: <h5nAkfBlAHA.236@asd24-aux-005.raketnet.nl>

Hi,

Does anyone have experience with odbc database engine and perl.
I run a 2.5MB database, having 15 tables.
The table most used is containing 21 fields. No big deal, I would say.
Still, to gather info for my website, it takes about 1 to 2 seconds to
simply get to the data.
So, I was wondering.... is there a better performing method of using
databases?
plz advise, if you can!!
Thanks!





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

Date: Sun, 11 Feb 2001 18:27:15 +1300
From: Lawrence D¹Oliveiro <ldo@geek-central.gen.new_zealand>
Subject: Re: Radical readdir suggestion
Message-Id: <ldo-24447C.18271511022001@news.wave.co.nz>

In article <slrn9892a6.vht.mgjv@martien.heliotrope.home>, 
mgjv@tradingpost.com.au wrote:

>On Sat, 10 Feb 2001 12:30:10 +1300,
>	Lawrence D¹Oliveiro <ldo@geek-central.gen.new_zealand> wrote:
>> In article <slrn984svj.vht.mgjv@martien.heliotrope.home>, 
>> mgjv@tradingpost.com.au wrote:
>> 
>>>On 7 Feb 2001 15:20:43 GMT,
>>>	Ilmari Karonen <iltzu@sci.invalid> wrote:
>>>
>>>But a loop of hard links can be created with otherwise named entries as
>>>well.
>> 
>> No, they cannot--try it.
>
>Yes they can. Make sure you're root, and on a system that hasn't
>implemented extra precautions to prevent it from happening.

And why do you think they would implement such precautions?

Besides, if only root can do it, then I don't see how it can count. 
There's a reason why it's disallowed.


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

Date: Sun, 11 Feb 2001 21:12:10 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Radical readdir suggestion
Message-Id: <slrn98cpbq.vht.mgjv@martien.heliotrope.home>

On Sun, 11 Feb 2001 18:27:15 +1300,
	Lawrence D¹Oliveiro <ldo@geek-central.gen.new_zealand> wrote:
> In article <slrn9892a6.vht.mgjv@martien.heliotrope.home>, 
> mgjv@tradingpost.com.au wrote:
> 
>>On Sat, 10 Feb 2001 12:30:10 +1300,
>>	Lawrence D¹Oliveiro <ldo@geek-central.gen.new_zealand> wrote:
>>> In article <slrn984svj.vht.mgjv@martien.heliotrope.home>, 
>>> mgjv@tradingpost.com.au wrote:
>>> 
>>>>On 7 Feb 2001 15:20:43 GMT,
>>>>	Ilmari Karonen <iltzu@sci.invalid> wrote:
>>>>
>>>>But a loop of hard links can be created with otherwise named entries as
>>>>well.
>>> 
>>> No, they cannot--try it.
>>
>>Yes they can. Make sure you're root, and on a system that hasn't
>>implemented extra precautions to prevent it from happening.
> 
> And why do you think they would implement such precautions?

Because Unix systems have fallen in the hands of people who don't always
know what they're doing. root on Unix _used_ to be someone who knew what
it was all about. That situation has changed. OSes have become more
defensive.

> Besides, if only root can do it, then I don't see how it can count. 
> There's a reason why it's disallowed.

Because it is dangerous. it can create almost impossible to detect loops
in a file system. That's why root alone is allowed to do it, and has
been allowed as the only user on a system for a very long time.

None of this has anything at all to do with Perl anymore. If you have a
problem with how the Unix file system is organised, and why it is the
way it is, I suggest you take this discussion to one of the unix groups.
The people there will be much better informed to tell you why exactly
things are as they are.

If you still want to argue that Perl's readdir() should deviate from its
roots, and start returning information that isn't faithful to the real
content, do so. If you want to investigate the history of Unix file
systems, take it to a Unix group.

Maybe you should consider buying some of W. Richard Stevens' books if
you want to know more about Unix, and how it works.

Martien
-- 
Martien Verbruggen              | Since light travels faster than
Interactive Media Division      | sound, isn't that why some people
Commercial Dynamics Pty. Ltd.   | appear bright until you hear them
NSW, Australia                  | speak?


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

Date: Sun, 11 Feb 2001 08:52:52 GMT
From: "Studio 51" <leekembel@hotmail.com>
Subject: Real userID? Effective UserID?
Message-Id: <Epsh6.126674$V22.26080244@news4.rdc1.on.home.com>

What's the difference between real and effective IDs? How do I go about
setting them? Are there any docs pertaining to them (I can't find many)?

I have a simple TCP server, and I don't want to run it as root. It needs to
start as root though so I can use chroot and bind to a port.


-S51




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

Date: Sun, 11 Feb 2001 21:20:27 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Real userID? Effective UserID?
Message-Id: <slrn98cprb.vht.mgjv@martien.heliotrope.home>

On Sun, 11 Feb 2001 08:52:52 GMT,
	Studio 51 <leekembel@hotmail.com> wrote:
> What's the difference between real and effective IDs? How do I go about
> setting them? Are there any docs pertaining to them (I can't find many)?
> 
> I have a simple TCP server, and I don't want to run it as root. It needs to
> start as root though so I can use chroot and bind to a port.

Real and Effective UID are not Perl-specific. Check a unix newsgroup to
find out what they are and how they differ, You may be able to find
enough information in the following references:

# man perlvar
# man perlsec

W. Richard Stevens, "Advanced Programming in the UNIX Environment"

The real uid is the uid of the user who started the process. The
effective uid is the uid of the user the program is running as.

Martien
-- 
Martien Verbruggen              | 
Interactive Media Division      | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd.   | Universe and Reboot +++
NSW, Australia                  | 


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

Date: Sun, 11 Feb 2001 12:01:54 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: Sending email from Perl Script on NT
Message-Id: <jQmh6.12$547.4283@vic.nntp.telstra.net>

"Jason Baumbach" <baumbach@bellatlantic.net> wrote in message
news:3A856CF0.3ACF4A14@bellatlantic.net...
> I agree that LWP may be a dead end.  Unfortunately, this still leaves me
> without email capabilities from within my Perl programs.
>
> I only need to send (not receive) simple email messages.  I tried both
> examples given in this mail thread but neither worked.  They both just
> completed successfully and did not complain nor did I ever see any email
> arrive from them.  I even tried an application named "Blat".  This is a
> command line application written in C++ that has example wrappers written
> in Perl.  Again, I was unable to get this to work.  I would explain but
> this is a Perl newsgroup and you people are probably not interested.
>
> I guess what I am trying to say is, Help!  I really need some simple way
to
> email people from within a Perl program on the Windows 2000 Server
> platform.
>
> Any and all reply will be appreciated.
>

I suppose sendmail for windows is out of the question?

www.dynamicstate.com

Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';




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

Date: Sun, 11 Feb 2001 06:10:58 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: split a path and keep the slashes?
Message-Id: <t8cb7ib00b11ea@corp.supernews.com>

Mona Wuerz (wuerz@yahoo.com) wrote:
:  $string =~ s#/+#/#g;                  # collapse multiple /

A much more efficient way to write that is:

  $string =~ tr#/##s;

-- 
   |   Craig Berry - http://www.cinenet.net/~cberry/
 --*--  "When the going gets weird, the weird turn pro."
   |               - Hunter S. Thompson


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

Date: Sat, 10 Feb 2001 22:00:17 -0500
From: "Kurt Stephens" <kstep@pepsdesign.com>
Subject: Re: undef ?
Message-Id: <964v5r$e3a$1@slb3.atl.mindspring.net>

"Brcin" <info@ultraviolet.li> wrote in message
news:rIeh6.914$Q8.49235@news.siol.net...
> undef $/ ;
> $_ = <STDIN> ;
>
> What exactly does that undef thing do?

In this case, it implements a bug waiting to happen when some other part of
your program expects to read files one line at a time.  Use local() to
confine the effects of changing perl's predefined variables to the enclosing
block of code.

SLURP_THIS: {
    local $/ = undef;
    $_ = <>;
}

Of course, for short programs that never read more than one file at a time
you don't need to worry about this.

Kurt Stephens





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

Date: Sun, 11 Feb 2001 10:24:22 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: undef ?
Message-Id: <n0qc8t01smjsng403sl0n731u995nl4fca@4ax.com>

Brcin wrote:

>undef $/ ;
>$_ = <STDIN> ;
>
>What exactly does that undef thing do?

It's not undef. It's $/. Normally this is "\n", and it's the line end
that <FILE> is looking for when reading a line. If it's not defined,
then the whole file will be read as one string, or should I say, as one
line.

Another special value for $/ is the empty string, which will search for
multiple newlines, at least two. The name for this is "paragraph mode".

-- 
	Bart.


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

Date: Sat, 10 Feb 2001 11:55:01 GMT
From: adelton@fi.muni.cz (Honza Pazdziora)
Subject: Re: UNIX core dumps - Segmentation Fault
Message-Id: <G8JIFp.2r8@news.muni.cz>

On Fri, 09 Feb 2001 22:30:58 GMT, hilljroberts@my-deja.com <hilljroberts@my-deja.com> wrote:
> I have a basic question about core dumps.  Everytime my program runs it
> core dumps and doesn't do any editing to any files that it is supposed
> to.  However if I run it in debug mode, the entire program runs fine,
> outputs and saves the necessary files, and does not core dump.  Does
> anyone know if there is something that I just forgot to do?  I know it
> has got to be some stupid error.  Also, the program runs fine on
> Windows based machines, it does not even display any errors from the
> interpreter.   What the heck!?!?!?!

Coredumping means that you trigger a serious bug in your Perl
interpreter. You can either narrow your code to see what Perl code
causes the problem and rephrase the code. Or you can upgrade/downgrade
your perl. Of course, if you see the problem with newest perls, you
should file a bug report.

Yours,

-- 
------------------------------------------------------------------------
 Honza Pazdziora | adelton@fi.muni.cz | http://www.fi.muni.cz/~adelton/
   .project: Perl, DBI, Oracle, MySQL, auth. WWW servers, DBD::XBase.
Petition for a Software Patent Free Europe http://petition.eurolinux.org
------------------------------------------------------------------------


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

Date: 11 Feb 2001 08:09:17 GMT
From: dha@panix6.panix.com (David H. Adler)
Subject: Re: Wanted: Perl Programmer for Chatologica Metasearch Mods
Message-Id: <slrn98ci5d.prs.dha@panix6.panix.com>

On Fri, 09 Feb 2001 20:46:24 GMT, Horace wrote:

>Wanted:  Perl programmer for paid services

You have posted a job posting or a resume in a technical group.

Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.

Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :)  (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)

Please do not explain your posting by saying "but I saw other job
postings here".  Just because one person jumps off a bridge, doesn't
mean everyone does.  Those postings are also in error, and I've
probably already notified them as well.

If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.

There is a Perl Jobs Announce list that may be more helpful to you.  See
<http://www.pm.org/mailing_lists.shtml> for details.

Yours for a better usenet,

dha


-- 
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
Perl can certainly be used as a first computer language, but it was
really designed to be a *last* computer language. - Larry Wall


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

Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.

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.

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 V10 Issue 268
**************************************


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