[13532] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 942 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 29 11:07:18 1999

Date: Wed, 29 Sep 1999 08:05:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <938617512-v9-i942@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Wed, 29 Sep 1999     Volume: 9 Number: 942

Today's topics:
        @INC and CGI problem edoloughlin@my-deja.com
    Re: acos function <rhomberg@ife.ee.ethz.ch>
    Re: acos function <sariq@texas.net>
    Re: ActivePerl, DCOM & Windows98 (Bert Blink)
        Calling windows API through Perl? tiiger@my-deja.com
    Re: Can I post messages to Windows in Perl like "SendMe tiiger@my-deja.com
    Re: Can I post messages to Windows in Perl like "SendMe (Mark A. Hershberger)
    Re: Can I post messages to Windows in Perl like "SendMe <gellyfish@gellyfish.com>
    Re: Can Perl interface a compiled C program and a web s <gellyfish@gellyfish.com>
    Re: CONTEST: Range Searching <jseigh@bbnplanet.com>
    Re: Dealing with "MS-ASCII" - again! (yes, I know it is (Kenny McCormack)
    Re: Dealing with "MS-ASCII" - again! (yes, I know it is <flavell@mail.cern.ch>
        deprecated $[ <TH@Dymaxion.ca>
        how to invoke DUN from perl? tony_barratt@my-deja.com
        Insert blank line between two lines? (Jason T. Breitweg)
    Re: Insert blank line between two lines? <gellyfish@gellyfish.com>
    Re: Insert blank line between two lines? <rhomberg@ife.ee.ethz.ch>
        Installing Tk on solaris? <Mario.Gonzalez@eto.ericsson.se>
    Re: Installing Tk on solaris? <tex@engsoc.carleton.ca>
    Re: kill extra white space in a variable <sariq@texas.net>
    Re: Matching problem with brackets (Anno Siegel)
    Re: Need a copy of Perl 5.0 for NT <gellyfish@gellyfish.com>
    Re: Need a copy of Perl 5.0 for NT <sariq@texas.net>
        newbie help: sorting multidimensional arrays <patrick@ocg6.marine.usf.edu>
        perl Ad <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
    Re: Perl IDE for X (Mark A. Hershberger)
    Re: Please compare and contrast C and Perl. (Matthew Bafford)
        Problem on AIX with Sys::Syslog <kiroul.pierre@libertysurf.fr>
        Q:post-compile testscripts fail <roman.legat@stud.uni-hannover.de>
        Question from a starter <i.m.t.swartjes@student.utwente.nl>
    Re: Question from a starter <gellyfish@gellyfish.com>
        RedHat Linux 6.0 and Perl 5.005_03 <mccomb@clubplanet.com>
        Sequential Debugging ? - Problems ynot353539@aol.com
    Re: Slice in scalar context (Anno Siegel)
    Re: Sorting weird numeric data (Anno Siegel)
    Re: UNIX (Solaris 2.6) to NT ACCESS DB? <gellyfish@gellyfish.com>
        Using Net::Ping troubles <pblalock@orgtek.com>
        Using system() and directory name with white space <Susumu.Sai@cognos.COM>
    Re: Win32::API -- how to call functions using NULL poin (Bbirthisel)
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Wed, 29 Sep 1999 13:37:09 GMT
From: edoloughlin@my-deja.com
Subject: @INC and CGI problem
Message-Id: <7st4m3$1u5$1@nnrp1.deja.com>

Hi,

I can't get my CGI scripts to work with the 'use' keyword and
any of the standard modules. I'm running Sambar on NT at the moment.
When I print @INC from a CGI prog I get correct results. When I do
a 'perl -V' I get (edited):

   Characteristics of this binary (from libperl):
     Locally applied patches:
           ActivePerl Build 518
     Built under MSWin32
     Compiled at Jun 24 1999 13:14:00
     @INC:
       C:/Perl/lib
       C:/Perl/site/lib/MSWin32-x86-object
       C:/Perl/site/lib
       .

All looks fine. It should pick up the pm files given the above
directories to search. AFAIK, the directory in which the script
is executed shouldn't be relevant, as the paths are absolute anyway.

Anybody got any ideas on what I'm doing wrong?

Thanks in advance,
Ed O'Loughlin.


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 29 Sep 1999 14:10:36 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: acos function
Message-Id: <37F201BC.43452391@ife.ee.ethz.ch>

jmn.ac.delete@abanet.it wrote:
> Has anyone a acos (cos-1, arccos) function for Perl.

> I am lazy.

You're obviously even too lazy to read the doc
acos is in perldoc -f cos

- Alex


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

Date: Wed, 29 Sep 1999 09:31:26 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: acos function
Message-Id: <37F222BE.E613B7A@texas.net>

jmn.ac.delete@abanet.it wrote:
> 
> Hi,
> 
> Has anyone a acos (cos-1, arccos) function for Perl.

It's in the docs.

> I am lazy.

Yes, you are.

- Tom


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

Date: Wed, 29 Sep 1999 22:34:02 +1000
From: bblink@pcug.org.au (Bert Blink)
Subject: Re: ActivePerl, DCOM & Windows98
Message-Id: <37f206f2.1524780@newshost.pcug.org.au>


Thanks all is  now fixed.  I reinstalled DCOM98 & then tried the
ActivePerl install & all went fine, ActivePerl installed without a
hitch.

bblink@pcug.org.au (Bert Blink) wrote:

>I have been trying to install ActicePerl but keep getting the message
>"can't install ActivePerl as DCOM needs to be installed".  Needless to
>say this is a malicious lie.
>
>I have Win98 SE installed & this comes with DCOM already installed.
>Anyone know how to make the ActivePerl install realise its mistake?  I
>have been to nearly all the FAQ's & searched all the NewsGroups but no
>mention seems to be made of install problems with Win98. I hope I am
>not unique.
>
> As far as I can tell the issue of whether DCOM is installed or not
>appears to be treated differently depending on what Software you are
>installing. VB6 claimed I didn't have it installed & said it would
>install it for me & hence finally installed itself.  Shortly after I
>wanted to install Personal Web Server (PWS) & it would not install
>because it claimed I didn't have DCOM installed.  This was after VB6
>claimed to have installed it & in spite of Win98 supposedly having it
>already installed.  Anyway I managed to find a site at Microsoft
>having DCOM98 an upgrade for Win98.  This I installed & much to my joy
>PWS installed.  BUT this still didn't help with ActivePerl install,
>still claiming I don't have DCOM installed (how many different tests
>for "is DCOM installed" are there?)
>
>Can anyone help?



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

Date: Wed, 29 Sep 1999 13:54:29 GMT
From: tiiger@my-deja.com
Subject: Calling windows API through Perl?
Message-Id: <7st5me$2pc$1@nnrp1.deja.com>

I am trying call windows API functions throught Perl.

How can I do it?

Thanks....


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: Wed, 29 Sep 1999 13:57:25 GMT
From: tiiger@my-deja.com
Subject: Re: Can I post messages to Windows in Perl like "SendMessage" in C ?
Message-Id: <7st5rs$2s2$1@nnrp1.deja.com>

Yes, it is running on a windows platform. Isn't there any support for
windows API.

I am new to Perl!!

Thanks,
Tiiger


In article <37F1CDA2.CF86285E@sophos.com>,
  Csaba Raduly <csaba.raduly@sophos.com> wrote:
> tiiger@my-deja.com wrote:
> >
> > Can I post messages to Windows in Perl like "SendMessage" in C++? I
> > will using this Perl script on Win95/98.
> >
> If the perl script does have a window, then of course you can.
> Whether it would have any effect is another matter :-)
>
> Csaba
> NOT sent via Deja.com
> Bored before you buy.
> --
> -----BEGIN GEEK CODE BLOCK-----
> Version 3.1
> GCS/>GMU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
> V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
> -----END GEEK CODE BLOCK-----
>
> Csaba Raduly,    Software Developer (OS/2),    Sophos Anti-Virus
> mailto:csaba.raduly@sophos.com            http://www.sophos.com/
> US Support +1 888 SOPHOS 9            UK Support +44 1235 559933
> Life is complex, with real and imaginary parts.
>


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 29 Sep 1999 09:52:43 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: Can I post messages to Windows in Perl like "SendMessage" in C ?
Message-Id: <49ln9pahxg.fsf@playpen.baileylink.net>

[mailed and posted]

tiiger@my-deja.com writes:

> In article <37F1CDA2.CF86285E@sophos.com>,
>   Csaba Raduly <csaba.raduly@sophos.com> wrote:
> > tiiger@my-deja.com wrote:
> > > Can I post messages to Windows in Perl like "SendMessage" in C++? I
> > > will using this Perl script on Win95/98.

> > If the perl script does have a window, then of course you can.
> > Whether it would have any effect is another matter :-)

> Yes, it is running on a windows platform. Isn't there any support for
> windows API.
> 
> I am new to Perl!!

Obviously.  http://www.perl.com/reference/query.cgi?windows+index

Next time, put what you are replying to above your reply.

Hope this helps,

Mark.

-- 


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

Date: 29 Sep 1999 15:57:23 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can I post messages to Windows in Perl like "SendMessage" in C ?
Message-Id: <37f228d3_2@newsread3.dircon.co.uk>

tiiger@my-deja.com wrote:

[ In the accursed Jeopardy style which I have fixed ]

> In article <37F1CDA2.CF86285E@sophos.com>,
>   Csaba Raduly <csaba.raduly@sophos.com> wrote:
>> tiiger@my-deja.com wrote:
>> >
>> > Can I post messages to Windows in Perl like "SendMessage" in C++? I
>> > will using this Perl script on Win95/98.
>> >
>> If the perl script does have a window, then of course you can.
>> Whether it would have any effect is another matter :-)
>>
> Yes, it is running on a windows platform. Isn't there any support for
> windows API.

Yes the module Win32::API  allows you some access to the API - there
is also Win32::GUI that allows you to create graphical programs.
> 
> I am new to Perl!!
> 


You might find that for specifically Win32 oriented questions you might
get a better response on one of the Win32 mailing lists that are 
available via <http://www.activestate.com>

/J\
-- 
"You look lovely this evening. Have you decreased in mass?" - Alien,
The Simpsons


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

Date: 29 Sep 1999 13:18:55 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Can Perl interface a compiled C program and a web site in HTML?
Message-Id: <37f203af_1@newsread3.dircon.co.uk>

Michael Orion Jackson <orion@ccwf.cc.utexas.edu> wrote:
> d.k. henderson (dalekh@hotmail.com) wrote:
> :  >I have a large C program I'd like to connect to a web site for users to
> : >execute. I don't know how to start. Can I use Perl?
> 
> : Here is an C CGI library that can be used with any compiler:
> : http://www.geocities.com/SiliconValley/Vista/6493/projects/cgi-lib.html
> 
> Well, one option that presents itself if you don't want to make your C
> binary a cgi app too or include perl into it is just get the appropriate
> command-line arguments for it from a form via CGI.pm, execute it with
> those optins (something like $output = system("/path/to/exe $options"); I
> guess), and generate a page to send back by including the output in it.
> 

Er no.  system doesnt allow you to capture the output of a command.

You could use the backticks (``) for that :

 $output = `/path/to/exe $options`;

> Be sure to make sure the input string of options doesn't have something
> nasty embedded in it by a malicios user.
> 

You might  want to read the section on safe pipe opens in the perlipc
manpage to find out how to do this safely without exposing the users
input to the shell.

/J\
-- 
"Report accuses Royal Opera House of 'arrogance and elitism'. Report
further alleges that Pope is Catholic. Report further claims that bears
may well indeed defecate in the woods" - Private Eye


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

Date: Wed, 29 Sep 1999 11:39:46 GMT
From: Joe Seigh <jseigh@bbnplanet.com>
Subject: Re: CONTEST: Range Searching
Message-Id: <37F1FA2E.6308D585@bbnplanet.com>

Here's my hack at it, the pathba part anyway.  It's a sliding window
kind of approach.

#!/usr/local/bin/perl5
use Getopt::Std;
getopts("a:b:c:") || exit 1;
(($opt_a + 0) < 0 || ($opt_b + 0) < 0 || ($opt_c + 0) < 0)
	&& die "-a, -b, or -c cannot be less than zero\n";
(($opt_a || $opt_b) && $opt_c) && die "-a or -b cannot be used with
-c\n";

$regexp = shift;
$match = eval "sub { $regexp; }";		# create closure on regexp;
$prefix = $opt_b + $opt_c + 0;
$suffix = $opt_a + $opt_c + 0;
@queue = ((undef) x $prefix);			# initialize delay queue
$count = $prefix + $suffix + 1;			# window size
$n = 0;

while (<>) {
	$n = $count if &$match();		# start/slide window
	push @queue, $_;
	$_ = shift @queue;
	print if ($n-- > 0);
}

# eof, drain delay queue
while ($n-- > 0) {
	print shift @queue;
}
	
exit;

First time I've had to use a closure, regexp ranges have state
information.
I've been burned by that before.  I assume that if you made it a
subroutine
with a block prototype parameter it would handle the regexp state
correctly,
but I haven't tried it out.

Joe Seigh


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

Date: 29 Sep 1999 07:28:54 -0500
From: gazelle@yin.interaccess.com (Kenny McCormack)
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <7st0m7$1uh$1@yin.interaccess.com>

In article <7ssbrr$ghk$1@nnrp1.deja.com>, PEZ  <pez68@my-deja.com> wrote:
>In article <7sr0ip$jt2$1@yin.interaccess.com>,
>  gazelle@interaccess.com wrote:
>> A few months ago, I posted about the problem of dealing with text
>>posted to the net from silly word processors like MS Word and so on
>>that have non-ASCII characters in them ("non-ASCII" meaning characters
>>whose code is >= 128)
>
>
>I'm not sure I understand what you mean with "deal" with these files.
>Do you want to convert them down to 7-bit? If so, I must ask why? In
>any case it's not all that straight forward to do the conversion. For
>instance take the Swedish extra three letters å (a-ring), ä (a-umlaut)
>and ö (o-umlaut). (Yes, those are letters and not just accented
>variants on a and o.) One way to deal with those are to strip off the
>rings and dots (umlauts), an assault on the Swedish language. But on 7-
>bit systems of old those have been replaced by the ASCII chars [, ], \,
>{, } and |. Terminals and programs reading files like those converted
>them back so that we Swedes can still see our dear extra letters. But
>you can imagine how source code looks on those terminals....

Yes, the goal is to render them 7-bit clean.  The goal is not to offend
non-American-English readers/speakers.  The goal *is* to offend users of
MS-Word, who do not know how to properly export their text for posting to
the Usenet.

Now, I think I may have gotten myself confused about which is the proper
"code page" to be concerned with.  Is it 850 or is it 1252 - that is the one
that explains the funny characters [mostly quote marks] that show up in
poorly exported MS Word documents?

I had gotten the idea from the previous thread that it was 1252, but
when I looked at and edited the 1252 page (and posted to the ng, in the
previous post), it seemed to have a lot more foreign language constructs
that I think it should have.

Also, I tried the "7-bit approximation" feature of lynx - all that seems to
do is remove the funny characters.  I'd rather do better than that.


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

Date: Wed, 29 Sep 1999 15:22:00 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Dealing with "MS-ASCII" - again! (yes, I know it is a bad term, but we're stuck with it)
Message-Id: <Pine.HPP.3.95a.990929151357.16629H-100000@hpplus01.cern.ch>

On 29 Sep 1999, Kenny McCormack wrote:

> Now, I think I may have gotten myself confused about which is the proper
> "code page" to be concerned with.  Is it 850 or is it 1252 

You'll mostly be concerned with 1252.  Other 125* pages are used in
different language areas, such as 1253 for Greek.

850 is the DOS Latin-1 code page.  You'll rarely encounter that in web
pages (the only browser I know that supports it as a charset attribute
is Lynx) and on the rare occasions when you do meet it, it's usually
because the author made a mistake (I mean, "didn't do what they
intended", rather than the win-1252 case, where it would be more
accurate to say they "did what they intended, but what they intended was
inadvisable" (if 8-bit characters) or "undefined" (if &#number; in the
range 128-159 decimal).

> I had gotten the idea from the previous thread that it was 1252,

You were right.

I _did_ hint before that we were off-topic here.  I'm taking stronger
measures this time, xposted and f'ups set, OK?



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

Date: Wed, 29 Sep 1999 15:01:43 GMT
From: "Tracey Hughes" <TH@Dymaxion.ca>
Subject: deprecated $[
Message-Id: <rRpI3.96$_G4.3378@sapphire.mtt.net>


I was wondering if anyone knows why exactly the $[ variable was deprecated
after release 5.





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

Date: Wed, 29 Sep 1999 13:09:47 GMT
From: tony_barratt@my-deja.com
Subject: how to invoke DUN from perl?
Message-Id: <7st32h$pm$1@nnrp1.deja.com>



Hi list,
I'm running active state perl 519 on W98, and NT. What I want to do is
to invoke a pre-defined connection defined in DUN so as to cause a dial-
out to a RAS access number (so I can do a Net::Ping to various hosts).
I thought that might be easy, and perhaps it is, just that I don't know
how to do it...
I suppose if it was possible to invoke a connection with a Start.Run,
then I could use a system("mi_coomand"). But maybe the answer llies in
the Win32 api?
If i get stuck I guess I could install RAS on NT, and not use the W98,
and cause a dial-out with a ping to a remote IP address (associated
with a phone num in RAS) but that's not really what i want to do.

Thanx ahead of time

Tony


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 29 Sep 1999 14:44:02 +0200
From: Jason.Breitweg@blind-guardian.com (Jason T. Breitweg)
Subject: Insert blank line between two lines?
Message-Id: <tkud7v1x4z1.fsf@zussun8.desy.de>

Hi all,

I am a self-professed perl beginner and I am having a tremendous brain
fart on how to do the following:

I have a bunch of lines (my CD list actually) and I want to put a new
line between lines that have a different first character.  For example
the original file would look like:

Blind Guardian - Imaginations from the Other Side
Blind Guardian - Nightfall in Middle Earth
Dream Theater - Falling Into Infinity

and I would like it to become:

Blind Guardian - Imaginations from the Other Side
Blind Guardian - Nightfall in Middle Earth

Dream Theater - Falling Into Infinity

Could someone enlighten me on how to do this?  Thanks in advance.

Jason

-- 
+-------------------+------------------------------+
| Jason T. Breitweg | Home:  +49 (0)40 23 80 90 98 |
| Muenzstr. 11      | Work:  +49 (0)40 89 98 31 57 |
| D-20097 Hamburg   | FAX:   +49 (0)40 23 80 90 81 |
| GERMANY           | Mobil: +49 (0)171 176 79 37  |
+-------------------+------------------------------+
| E-mail: Jason.Breitweg@blind-guardian.com        |
| http://www-zeus.desy.de/~breitweg                |
+--------------------------------------------------+


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

Date: 29 Sep 1999 15:28:25 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Insert blank line between two lines?
Message-Id: <37f22209_1@newsread3.dircon.co.uk>

Jason T. Breitweg <Jason.Breitweg@blind-guardian.com> wrote:
> Hi all,
> 
> I am a self-professed perl beginner and I am having a tremendous brain
> fart on how to do the following:
> 
> I have a bunch of lines (my CD list actually) and I want to put a new
> line between lines that have a different first character.  For example
> the original file would look like:
> 
> Blind Guardian - Imaginations from the Other Side
> Blind Guardian - Nightfall in Middle Earth
> Dream Theater - Falling Into Infinity
> 
> and I would like it to become:
> 
> Blind Guardian - Imaginations from the Other Side
> Blind Guardian - Nightfall in Middle Earth
> 
> Dream Theater - Falling Into Infinity
> 
> 

Add another newline character ?

print "Blind Guardian - Imaginations from the Other Side\n";
print "Blind Guardian - Nightfall in Middle Earth\n\n";
print "Dream Theater - Falling Into Infinity\n";


/J\
-- 
"While we've been on the air we've had reports that Prince Charles has
eaten beef on the bone" - Justin Webb, BBC One O'Clock News


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

Date: Wed, 29 Sep 1999 17:02:27 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Insert blank line between two lines?
Message-Id: <37F22A03.97B2CAE8@ife.ee.ethz.ch>

Jason T. Breitweg wrote:
> I am a self-professed perl beginner and I am having a tremendous brain
> fart on how to do the following:
> 
> I have a bunch of lines (my CD list actually) and I want to put a new
> line between lines that have a different first character.  For example
> the original file would look like:

perl -i -pe'/^$1/||print$/;/(.)/' song_list

add (?i) as needed. Exercise: Find out why it works (at least it does
for your data)

- Alex
PS Is this acceptable Perl golf?


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

Date: Wed, 29 Sep 1999 15:45:14 +0200
From: Mario Gonzlez <Mario.Gonzalez@eto.ericsson.se>
Subject: Installing Tk on solaris?
Message-Id: <37F217EA.17D06E5F@eto.ericsson.se>

Hi
I'm quite new to this perl-stuff so I'm not sure if this is the right
mailing list.
I have written a small thing in perl which uses Tk for user interaction.
Now when it finally works I would like to run it on another machine. The
problem is that the machine does not have Tk installed and has no
compiler.
Is there a binary distribution of Tk available somewhere? Or can I
perhaps compile it myself somehow? The target machine in question is a
SUN Enterprise Server with OS-Version SunOS 5.5.1

any help would be appreciated

mario





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

Date: 29 Sep 1999 14:11:39 GMT
From: Clayton L. Scott <tex@engsoc.carleton.ca>
Subject: Re: Installing Tk on solaris?
Message-Id: <7st6mr$5ae$2@bertrand.ccs.carleton.ca>

You, yes you, Mario. Stop writing stuff like this:
: Hi
: I'm quite new to this perl-stuff so I'm not sure if this is the right
: mailing list.

	This is not a mailing list. It is a newsgroup. Read
 news.announce.newusers for guidelines on participating in newsgroups .

: Is there a binary distribution of Tk available somewhere? Or can I
: perhaps compile it myself somehow? The target machine in question is a
: SUN Enterprise Server with OS-Version SunOS 5.5.1

	This is not a perl question. Try asking in a Tcl forum such as
 comp.lang.tcl


/tex
-- 
Warning: Dates on calendar are closer than they appear.


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

Date: Wed, 29 Sep 1999 08:55:43 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: kill extra white space in a variable
Message-Id: <37F21A5F.7618025A@texas.net>

David Amann wrote:
> 
> I don't know what's causing the phantom space, but here's a quick code
> snippet to get leading or trailing whitespace from your string.
> 
> $string =~ s/^\s+//;
> $string =~ s/\s$//;
> 
> Hope this helps,
> -=dav

Next time you attempt to quote the FAQ, perhaps you should just
cut-and-paste.

It's:

$string =~ s/^\s+//;
$string =~ s/\s+$//;

Better yet, just reference said FAQ (perlfaq4 in this case).

- Tom


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

Date: 29 Sep 1999 13:25:49 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Matching problem with brackets
Message-Id: <7st40t$9qp$1@lublin.zrz.tu-berlin.de>

Jim Drummey  <jpd@drum.terranet.com> wrote in comp.lang.perl.misc:
>I'm trying to find lines in a Samba config file by passing a parameter
>containing a share name.
>
>The lines begin with a square bracket followed by the share name and
>ending with a square bracket like so:
>[sharename]
>
>I've tried several combos including:
>if ( /^\[$sharename/ )   doesn't work

It should.  In which way doesn't it work?  Too many hits?  Too few?
doesn't compile?  Sits on the sofa and pouts?  Is on strike for more
money?

>if ( $_ =~ $sharename && /^\[/ )  each of these conditions works by
>                                  itself, but not when separated by
>                                  the && operator 
>
>If I leave one condition out, the statement works. I need to test
>both conditions, that is 1) square brackets begin line and 2) followed
>by $sharename.

Well, that's not how you combine regular expressions, not in Perl
anyway.  Intuition is useful, but must be backed up by hard facts,
preferably from a manual.  In particular, intuition may be misleading
when it comes to precedence of operators.  Try

   m/^\[/ && m/$sharename/

Note that $_ is the default search space, so $_ =~ ... is never
necessary.  Also note that your first attempt should work, in
the sense that it matches lines beginning with a [, followed
by whatever is in $sharename at the time.  Did you check *that*?

Anno


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

Date: 29 Sep 1999 14:09:47 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Need a copy of Perl 5.0 for NT
Message-Id: <37f20f9b_1@newsread3.dircon.co.uk>

Dadwalrus <dadwalrus@aol.com> wrote:
> Does anyone know where I can download a copy of Perl 5.0 for Windows NT?  
> Any help would be appreciated.

<http://www.activestate.com/activeperl>

/J\
-- 
"People say money brings its own problems. Rubbish, rubbish - I'm loaded -
it's fantastic" -


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

Date: Wed, 29 Sep 1999 09:45:40 -0500
From: Tom Briles <sariq@texas.net>
Subject: Re: Need a copy of Perl 5.0 for NT
Message-Id: <37F22614.3DE27A00@texas.net>

ldh7@my-deja.com wrote:
> 
> Does anyone know where I can find a copy of Perl 5.0 for Windows NT
> that is available for downloading?
> Any help would be appreciated.
> Thank you,
> Laura

Why did you reply to yourself from a second account?

Anyway, go to http://www.activestate.com.

- Tom


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

Date: Wed, 29 Sep 1999 10:51:14 -0400
From: Patrick Smith <patrick@ocg6.marine.usf.edu>
Subject: newbie help: sorting multidimensional arrays
Message-Id: <37F22762.41C6@ocg6.marine.usf.edu>

Hi, 

I'm kind of new to this. I need to know if there is a way to sort a
multidimensional [10,5] array using the first element of each row as the
sorted item and keeping the other 4 elements of the row in origional
order together with the first element after having sorted all ten rows.
All the elements will be numbers.

I hope this question makes sense.

Thank You in advance.

Patrick


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

Date: Wed, 29 Sep 1999 00:02:20
From: "One Bored Guru        " <One.Bored.Guru........@p0.f1.n30.z30.fidonet.org>
Subject: perl Ad
Message-Id: <00000670@madnet.net>

Attention Perl-5/Linux Programmers.

The Sync3 Developement Team is looking for Perl-5/Linux programmers
to help on an open source project writing a new type of bbs designed
for Linux and The Internet.  If you think you have the skill and are
interested, please send email to devteam[at]sync3.com indicating your
interest and providing us with the relevant details pertaining to
your skill level and previous experience.  Thank you for your time
and interest.

     Steve Byers,
     Project Administrator,
     The Sync3 Project.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
        + The Talamasca Internet Newsgroup Gateway +
               telnet://talamasca-bbs.com


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

Date: 29 Sep 1999 09:39:29 -0500
From: mah@everybody.org (Mark A. Hershberger)
Subject: Re: Perl IDE for X
Message-Id: <49ogelaiji.fsf@playpen.baileylink.net>

[mailed and posted]

Francisco Romero <fromero@csudh.edu> writes:

> Does anyone know if there is an Integrated Developmental Enviornment for
> perl?
> 
> Is there anything to help me write Perl code in X ?

Do you mean "I want to write X-Windows programs in Perl?"

If so, Check out Perl/Tk or Gtk-Perl.  If you want to write graphical
programs portable between Unix, Windows and, I believe, Mac, then
Perl/Tk is the way to go.

Mark.

-- 


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

Date: Wed, 29 Sep 1999 13:11:25 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Please compare and contrast C and Perl.
Message-Id: <slrn7v42re.pr.*@dragons.duesouth.net>

On Wed, 29 Sep 1999 01:57:18 GMT, hennessy@cloud9.net (Mathew A.
Hennessy) spewed forth: 
: In article <slrn7v2s2j.9kl.abigail@alexandra.delanet.com>,
: Abigail <abigail@delanet.com> wrote:
: >
: >Abigail
: 
: 	btw: if you use trn, you can avoid these threads..  the <shift>
: and 'd' keys on your kybd seem to be functional.. ;)

From: abigail@delanet.com (Abigail)
User-Agent: slrn/0.9.5.4 (UNIX)

Not that slrn doesn't have that feature.

--Matthew


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

Date: Wed, 29 Sep 1999 16:47:03 +0200
From: "kiroul.pierre" <kiroul.pierre@libertysurf.fr>
Subject: Problem on AIX with Sys::Syslog
Message-Id: <7st8pc$e7q$1@news2.isdnet.net>

On an AIX Platform
When I try to execute the following script:
______________________________________________________
#!/usr/lpp/ssp/perl5/bin/perl -w

require strict;
use Sys::Hostname;
use Sys::Syslog;

openlog('prog_test','cons,pid','user');

closelog();
______________________________________________________

I get the following errors at compile time:
Useless use of gethostbyname in void context at
/usr/lpp/ssp/perl5/lib/Sys/Hostname.pm line 42
Undefined Subroutine &Sys::Syslog::hostname called at
/usr/lpp/ssp/perl5/lib/Sys/Syslog.pm line 92
BEGIN Failed -- compilation aborted

Anybody knows what the trouble is?

Thanks in advance






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

Date: Tue, 28 Sep 1999 23:03:00 +0200
From: Roman Legat <roman.legat@stud.uni-hannover.de>
Subject: Q:post-compile testscripts fail
Message-Id: <37F12D04.99FFBE71@stud.uni-hannover.de>

Hi!

I tried to compile Perl (which worked fine) but the testsuite won't run
completely, three tests always fail, the rest works.
The tests that fail are getopt, dup and io_dup.
They all fail when trying to close a file, so I have a reduced
script :

open(STDOUT,">Io.dup");
print "hello, world";
close(STDOUT);

This will produce the Io.dup containing "hello, world" but then crashes
(i think with a segmentation fault)
Does anyone know this problem (or its solution?)

CU, Roman


-- 
Roman Legat
email: roman.legat@stud.uni-hannover.de
[ stud means student ;) ]

	Anything is good, if it's made of chocolate


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

Date: Wed, 29 Sep 1999 15:50:51 +0200
From: "Ivo Swartjes" <i.m.t.swartjes@student.utwente.nl>
Subject: Question from a starter
Message-Id: <7st5f4$95d$1@dinkel.civ.utwente.nl>

I was wondering how a multidimensional array is created in Perl (something
like @name=((a,b),(c,d),(e,f)) ?  ) and how I can access say the second
element of the third subarray (which is f in this case)...someone said
something like $value = @name{3}{2} but that doesn't work...I've tried
@name[3,2] too, without good results

Hope someone can help me in this
Ivo




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

Date: 29 Sep 1999 15:53:05 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Question from a starter
Message-Id: <37f227d1_2@newsread3.dircon.co.uk>

Ivo Swartjes <i.m.t.swartjes@student.utwente.nl> wrote:
> I was wondering how a multidimensional array is created in Perl (something
> like @name=((a,b),(c,d),(e,f)) ?  ) and how I can access say the second
> element of the third subarray (which is f in this case)...someone said
> something like $value = @name{3}{2} but that doesn't work...I've tried
> @name[3,2] too, without good results
> 

You really do want to read the perldata and perldsc manpages ... In reallity
there is no such thing as multidimensional array in Perl - you can only
have a single dimension containing references to further arrays ...

@name = (
          ["blah","woof"],
          ["plio","roow"],
          ["zippey","dippey"]
        );

print $name[3][0]; # zippey


the form @name[3,2] is an array 'slice' - that is it returns elements 3 & 2
from the array @name.

/J\
-- 
"Doctors, psychologists and animators have been called in to investigate"
- Channel 4 News


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

Date: Wed, 29 Sep 1999 09:40:04 -0400
From: "news.way.com" <mccomb@clubplanet.com>
Subject: RedHat Linux 6.0 and Perl 5.005_03
Message-Id: <RGoI3.54$SS2.2304@dfw-read.news.verio.net>

I have some very wierd behavior with some Perl scripts under a new Linux
install.

Basically,  if the script starts with

#!/usr/bin/perl

when I execute the script I get a "command not found" error message.  If the
script starts with:

!#/usr/bin/perl -w

the script runs as expected.  Any ideas?


Also, trying to execute a chmod command from within a CGI script does not
seem to do anything, but when run from a shell it executes correctly.

Very hard to track down these problems.  Thanks for any help.




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

Date: Wed, 29 Sep 1999 13:09:39 GMT
From: ynot353539@aol.com
Subject: Sequential Debugging ? - Problems
Message-Id: <7st329$pi$1@nnrp1.deja.com>

My program is getting a little complex.

I am using CGI.pm and myownDate.pm
For the latter I had to add a BEGIN block to push the dir on @INC

Now when I debug from the cl execution starts in one of the subroutines.
The Debugger SKIPS the 1st 15 lines of the program.

Can anyone help ?  suggestions ?
Thx in advance.
Alt email:  invinfo@enteract.com    - Robert Kattke, IIS


Sent via Deja.com http://www.deja.com/
Before you buy.


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

Date: 29 Sep 1999 12:31:07 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Slice in scalar context
Message-Id: <7st0qb$9ns$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:

>but what about the items themselves? if all you want is the number, just
>hardwire that value. why count a list you throw away?

The list may be easier to maintain if it changes occasionally.  I
admit it isn't easy to come up with a realistic example, but I may
want to add to or delete from the list and leave th counting to Perl.

Anno


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

Date: 29 Sep 1999 13:54:19 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Sorting weird numeric data
Message-Id: <7st5mb$9s1$1@lublin.zrz.tu-berlin.de>

Uri Guttman  <uri@sysarch.com> wrote in comp.lang.perl.misc:

[...]

>true, complex lists of pack fields can be confusing but this uses just
>C5 which is 5 unsigned chars. pretty easy to figure out. and it should
>be commented anyway. also i think there is a pack field comment syntax
>being worked on by ilya for 5.6 or beyond.

I've been thinking of a pack-string compiler -- the problem is of
course, how do you specify the data structure you want to pack/unpack.
A somewhat extended/restricted (yes, both at a time) C struct comes
to mind, but then, how is that superior to bare pack?

So the idea is canned for the moment.

Anno


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

Date: 29 Sep 1999 15:08:04 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: UNIX (Solaris 2.6) to NT ACCESS DB?
Message-Id: <37f21d44_1@newsread3.dircon.co.uk>

Scott McMahan <scott@aravis.softbase.com> wrote:
> Kragen Sitaker (kragen@dnaco.net) wrote:
>> Second, in order to do this, you need to understand the .mdb file
>> format.
> 
> The problem with this is it isn't a file per se but a COM storage.
> The source code is just a bunch of COM calls.
> 

The question about the format of ms-access files on the group 
comp.databases.ms-access is much like then question about validating
mail addresses here - I FAQ with no positive answer...

/J\
-- 
"People say money brings its own problems. Rubbish, rubbish - I'm loaded -
it's fantastic" -


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

Date: Wed, 29 Sep 1999 09:29:27 -0400
From: "Patrick Blalock" <pblalock@orgtek.com>
Subject: Using Net::Ping troubles
Message-Id: <7st47o$pv8$1@news.orgtek.com>

I was trying to write some utilities using Perl and the Net::Ping module.  I
tried the example in Perldoc and in the Perl Cookbook:
> more ping.pl
#!/usr/bin/perl

use Net::Ping;

$host = "testbox";

$p = Net::Ping->new();
print "$host is alive...\n" if $p->ping($host);
$p->close;

When I run the script I get the following error:

> ping.pl
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at
/usr/lib/perl5/5.00503/i386-linux/Socket.pm line 295.

I'm running Red Hat Linux 6.0 and Perl 5.005_03, does anyone know what the
problem with this script is?

Thanks in advance,

Patrick




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

Date: Wed, 29 Sep 1999 14:05:32 GMT
From: "Susumu" <Susumu.Sai@cognos.COM>
Subject: Using system() and directory name with white space
Message-Id: <M0pI3.1380$7S6.529@198.235.216.4>

My perl program:

    $dir = "ab\\cde fg\\hjk";
    system ("mkdir $dir");

When I run the perl program in ActivePerl build 509 in Windows NT, I got an
error message like:

    mkdir: directory $B!H(Bab\cde$B!I(B: can not find the path.
    mkdir: directory $B!H(Bfg\hjk$B!I(B: can not find the path.

I tried $dir = "ab\\\$B!I(Bcde fg\"\\hjk", but it doesn$B!G(Bt work too.

Does anyone know how to use the system() command and directory name with a
white space.

Thanks for any help.

Susumu



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

Date: 29 Sep 1999 13:03:23 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Win32::API -- how to call functions using NULL pointers?
Message-Id: <19990929090323.01353.00000041@ng-bg1.aol.com>

Hi Eric:

>Unfortunately, the documentation for the Win32::API doesn't specify how
>to send a NULL pointer.  I've tried using "pointers" (scalars) that are
>undefined, or set to 0.  Of course, if they're set to 0, then it's just
>a pointer to that number.

How did you do it? In Win32API::CommPort, I put:

my $null =0;

>Does anyone know how I'd specify a NULL pointer using the module?  I've
>included the complete test script I'm using below.  My perl is Gurusamy
>version 5.004.

>$RasDial->Call(undef,undef,$RASDIALPARAMS,$DWNOTIFIERTYPE,undef,undef);

$RasDial->Call($null,$null,$RESDIALPARAMS,$DWNOTIFIERTYPE,$null,$null);

I use similar calls on both 5.004 and 5.005. I did not check your
declaration in the API docs.

-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)


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

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 V9 Issue 942
*************************************


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