[19201] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1396 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jul 28 09:05:33 2001

Date: Sat, 28 Jul 2001 06:05:10 -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: <996325510-v10-i1396@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Sat, 28 Jul 2001     Volume: 10 Number: 1396

Today's topics:
    Re: argv or getopt on Windows 2000 pro <kalinabears@hdc.com.au>
        Calling my script method? <millettNOSPAM@lblueyonder.co.uk>
    Re: Calling my script method? nobull@mail.com
    Re: Data Interchange Format nobull@mail.com
    Re: Email to mySQL <jeff@vpservices.com>
    Re: Emal Options Robustness (Kev)
    Re: Emal Options Robustness nobull@mail.com
    Re: Emal Options Robustness <pne-news-20010728@newton.digitalspace.net>
        FAQ: How can I access/change the first N letters of a s <faq@denver.pm.org>
        FAQ: How do I reformat a paragraph? <faq@denver.pm.org>
        Flock on DATA? <goldbb2@earthlink.net>
        hash <a.v.a@home.nl>
    Re: hash (Eric Bohlman)
    Re: How to use setuid in perl? nobull@mail.com
    Re: How to use setuid in perl? <shyan@cse.cuhk.edu.hk>
    Re: How to use setuid in perl? <pne-news-20010728@newton.digitalspace.net>
    Re: Optimization Question nobull@mail.com
    Re: Re: Regular Expression <jnurick@zdnetonebox.com>
        SHEBANG ? <john@trumpetweb.co.uk>
    Re: Single char formats => core dump?!? <goldbb2@earthlink.net>
        Striping out the string <Killiam@hotmail.com>
    Re: Stripping extention from a filename in a string <Tassilo.Parseval@post.rwth-aachen.de>
    Re: What am I doing wrong with this command line ? <goldbb2@earthlink.net>
    Re: What am I doing wrong with this command line ? <goldbb2@earthlink.net>
    Re: Who can help me about the confused (..) operator? <pne-news-20010728@newton.digitalspace.net>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Sat, 28 Jul 2001 19:51:59 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: argv or getopt on Windows 2000 pro
Message-Id: <996350241.472391@clover.origin.net.au>


"Stephen Uitti" <suitti@yahoo.com> wrote in message
news:6f9c7a55.0107261244.314ac7e9@posting.google.com...
> First, I read all the related articles from 1997 on by searching google.
> I tried:
>
> FTYPE tst.pl=perl.exe %1 %*
> FTYPE tst.pl=perl.exe "%1" %*
> PerlScript=perl.exe %1 %*
> Perl=c:\perl\nsPerl5.005_03\nsperl.exe "%1" %*
>
> and even dorked around with RegEdit.
>
> etc., to no avail.  (At least things aren't worse).
>
> Under Linux, this script works:
>
> #!/usr/bin/perl
> use Getopt::Long;
> my $cnt = 10; # Default # of files.
> GetOptions("cnt=i" => \$cnt);
> print "$cnt\n";
>
> % tst.pl --c=12
> 12
>
> But under Windows 2000 Pro, from the cmd prompt (they're not calling it
DOS,
> I guess), I get:
>
> C:\>tst.pl --c=12
> 10
>
> I've tried looking at ARGV[0] directly (there's nothing there under
Windows,
> even though the exact same code works under Linux.)
>
> This is NOT CGI, just the command line.
>
> OK, I admit it.  Though I've used Unix for 19 years, and
> perl was my primary language for more than two years, this
> is my first perl forray on any Windows.  Most things work.  For example,
> DirHandle
> File::stat
> File::copy
> Net::FTP
> Mail::Sendmail
> all work great.
>
> The other upcoming problem: Can Perl be used to read/move email
> messages in Outlook?  A vbs script appears to be using a MAPI
> session... really ugly strings used as IDs...
> Perhaps there's a better way.
>
> Any help is appreciated.
> Stephen.

Hi,

From a post on perl-win32-users mailing list:
--------snip

Folder Options-->File Types-->Select .pl file
association-->Advanced-->Highlight 'Open'-->Edit

And I have this ------ E:\Perl\bin\Perl.exe "%1" %*

Strikes me that if NT is similar and the association did not have the %1 %*
on the end then you would get the behavior you describe - that is, it works
fine without params but doesn't do squat with any params.
-------- end snip

In other words, for both the file association, and the reading of command
line arguments, to work, you need, on that machine :
E:\Perl\bin\Perl.exe "%1" %*

So I'd check (and amend, if necessary) your file association settings using
the method outlined above.

Win32::OLE might be able to handle your mail manipulation. The same mailing
list would be a good place for you to follow it up.

Hth.
Cheers,
Rob




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

Date: Sat, 28 Jul 2001 03:55:09 GMT
From: "millside" <millettNOSPAM@lblueyonder.co.uk>
Subject: Calling my script method?
Message-Id: <xIq87.3107$o_.406945@news1.cableinet.net>

Hi,
I have a guest book written in perl and call it from a link on my page:
<a href=superguest.cgi>View my guestbook</a>
However the script is within a password protected sub-directory
(cgi-bin/guestbook)
and prompts user for authorization. If I supply my username/pass combination
it works OK.
My other scripts are also within sub-directories of the cgi-bin and work
without first asking for
authorization. Is there a method to use which would work without me having
to move it to
the public directory? I have tried calling it with: <FORM NAME="guestbook"
METHOD="post"
ACTION="http://www.my-domain.com/cgi-bin/guestbook/superguest.cgi
but even with: use CGI::Carp qw(fatalsToBrowser);
I only get standard server error "The server encountered an internal error
or
misconfiguration and was unable to complete your request"
Thanks for (hopefully) some forthcoming insight.

--
millside
_____________








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

Date: 28 Jul 2001 07:48:01 +0100
From: nobull@mail.com
Subject: Re: Calling my script method?
Message-Id: <u9u1zxv9b2.fsf@wcl-l.bham.ac.uk>

"millside" <millettNOSPAM@lblueyonder.co.uk> writes:

> Newsgroups: comp.lang.perl.misc

This is a Perl newsgroup.

> I have a guest book written in perl and call it from a link on my page:
> <a href=superguest.cgi>View my guestbook</a>
> However the script is within a password protected sub-directory
> (cgi-bin/guestbook)
> and prompts user for authorization. If I supply my username/pass combination
> it works OK.
> My other scripts are also within sub-directories of the cgi-bin and work
> without first asking for
> authorization. Is there a method to use which would work without me having
> to move it to
> the public directory?

There is no Perl in that question. Is it not obvious to you that this
is a question about web server configuration and the answer would be
exactly the same whatever language you'd used to write the CGI script?

Try a newsgroup that deals with web server configuation.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 28 Jul 2001 08:24:42 +0100
From: nobull@mail.com
Subject: Re: Data Interchange Format
Message-Id: <u9ofq5v7lx.fsf@wcl-l.bham.ac.uk>

beast@avalon.albuquerque.nm.us (Robert Goff) writes:

> I've looked and looked, but I haven't found code that will parse a DIF
> file, the DIF that is produced by spreadsheet programs and FileMaker
> Pro, specificially.  Any suggestions?  Thanks.

Is DIF not CSV?  There are modules to handle CSV.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Fri, 27 Jul 2001 22:35:10 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Email to mySQL
Message-Id: <3B624F0E.480CA24E@vpservices.com>

Graham Burgess wrote:
> 
> I can do everything easily enough except processing the incoming email to
> put it into a database format so I was wondering if anyone has done this in
> the past and could help me.

I am working on a mail <-> DBI plug-in for my DBD::AnyData module
(formerly called DBD::RAM).  Sorry but the mail part isn't ready for
prime time yet.  RSN.

-- 
Jeff



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

Date: Sat, 28 Jul 2001 07:25:14 GMT
From: NOSPAMlekkerinsydney@ozemail.com.au (Kev)
Subject: Re: Emal Options Robustness
Message-Id: <3b62688d.159036@news.ozemail.com.au>

Thanks for the responses.

Can someone please explain to me why the perl SMTP
module is not the quickest option ?

I would have thought that this would be the best
option as it communicates directly with the smtp
server bypassing a program ? am I mssing
something.

Apologies if this is slightly off topic.

Kevin

On Sat, 28 Jul 2001 12:38:13 +1000, "Tintin"
<somewhere@in.paradise.net> wrote:

:
:"Kev" <NOSPAMlekkerinsydney@ozemail.com.au> wrote in message
:news:3b61a842.266562@news.ozemail.com.au...
:> Hi All
:>
:> Which of the following (all things equal) would
:> you gurus suggest to be the most robust for a
:> relatively email heavy perl program:
:> - perl with sendmail on unix
:> - perl with blat on NT
:> - perl with the SMTP module on unix
:> - perl with the SMTP module on nt
:
:Not really much to do with Perl, but the first option (unix/sendmail) is by
:far and away, the best.
:
:
:
:



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

Date: 28 Jul 2001 07:44:00 +0100
From: nobull@mail.com
Subject: Re: Emal Options Robustness
Message-Id: <u9wv4tv9hr.fsf@wcl-l.bham.ac.uk>

NOSPAMlekkerinsydney@ozemail.com.au (Kev) writes rudely in jeopary style

[ jeopardectomy ]

> :"Kev" <NOSPAMlekkerinsydney@ozemail.com.au> wrote in message
> :news:3b61a842.266562@news.ozemail.com.au...
> :> Hi All
> :>
> :> Which of the following (all things equal) would
> :> you gurus suggest to be the most robust for a
> :> relatively email heavy perl program:
> :> - perl with sendmail on unix
> :> - perl with blat on NT
> :> - perl with the SMTP module on unix
> :> - perl with the SMTP module on nt

These options are not mutually exclusive not exhaustive.

I would use SMTP module to pass mail to sendmail.

> :Not really much to do with Perl, but the first option (unix/sendmail) is by
> :far and away, the best.

> Can someone please explain to me why the perl SMTP
> module is not the quickest option ?

Because re-implementing a full-featured MTA in Perl will take you
years.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 28 Jul 2001 10:37:26 +0200
From: Philip Newton <pne-news-20010728@newton.digitalspace.net>
Subject: Re: Emal Options Robustness
Message-Id: <j4u4mt85duonmsmf1jra2drk2rq60dmoad@4ax.com>

[Please don't post your reply above the original message. Please trim
the original message to the parts you are referring to.]

On Sat, 28 Jul 2001 07:25:14 GMT, NOSPAMlekkerinsydney@ozemail.com.au
(Kev) wrote:

> Can someone please explain to me why the perl SMTP
> module is not the quickest option ?

You didn't ask for "quickest" in the original question.

> I would have thought that this would be the best
> option as it communicates directly with the smtp
> server bypassing a program ?

"best" is not "quickest". It may be fastest for the pure connection
thing, but you have to handle stuff such as

* finding the correct MX for a given domain
* trying all the mail exchangers in preference order until you find one
you can connect to
* backing off (possibly exponentially) and retrying if you can't connect
* handling temporary DNS and SMTP errors

youself. (Did I miss anything important?)

Using a special-purpose program such as sendmail saves you all this
trouble: you can just hand over your message to the MTA and it'll do its
best for you, probably sending you email back if it is finally
unsuccessful.

> am I mssing something.

Error handling, apparently.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: Sat, 28 Jul 2001 12:18:11 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How can I access/change the first N letters of a string?
Message-Id: <74y87.122$os9.204208640@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How can I access/change the first N letters of a string?

    There are many ways. If you just want to grab a copy, use substr():

        $first_byte = substr($a, 0, 1);

    If you want to modify part of a string, the simplest way is often to use
    substr() as an lvalue:

        substr($a, 0, 3) = "Tom";

    Although those with a pattern matching kind of thought process will
    likely prefer

        $a =~ s/^.../Tom/;

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.25
-- 
    This space intentionally left blank


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

Date: Sat, 28 Jul 2001 06:18:01 GMT
From: PerlFAQ Server <faq@denver.pm.org>
Subject: FAQ: How do I reformat a paragraph?
Message-Id: <tOs87.121$os9.199372800@news.frii.net>

This message is one of several periodic postings to comp.lang.perl.misc
intended to make it easier for perl programmers to find answers to
common questions. The core of this message represents an excerpt
from the documentation provided with every Standard Distribution of
Perl.

+
  How do I reformat a paragraph?

    Use Text::Wrap (part of the standard Perl distribution):

        use Text::Wrap;
        print wrap("\t", '  ', @paragraphs);

    The paragraphs you give to Text::Wrap should not contain embedded
    newlines. Text::Wrap doesn't justify the lines (flush-right).

- 

Documents such as this have been called "Answers to Frequently
Asked Questions" or FAQ for short.  They represent an important
part of the Usenet tradition.  They serve to reduce the volume of
redundant traffic on a news group by providing quality answers to
questions that keep coming up.

If you are some how irritated by seeing these postings you are free
to ignore them or add the sender to your killfile.  If you find
errors or other problems with these postings please send corrections
or comments to the posting email address or to the maintainers as
directed in the perlfaq manual page.

Answers to questions about LOTS of stuff, mostly not related to
Perl, can be found by pointing your news client to

    news:news.answers

or to the many thousands of other useful Usenet news groups.

Note that the FAQ text posted by this server may have been modified
from that distributed in the stable Perl release.  It may have been
edited to reflect the additions, changes and corrections provided
by respondents, reviewers, and critics to previous postings of
these FAQ. Complete text of these FAQ are available on request.

The perlfaq manual page contains the following copyright notice.

  AUTHOR AND COPYRIGHT

    Copyright (c) 1997-1999 Tom Christiansen and Nathan
    Torkington.  All rights reserved.

This posting is provided in the hope that it will be useful but
does not represent a commitment or contract of any kind on the part
of the contributers, authors or their agents.

                                                           04.24
-- 
    This space intentionally left blank


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

Date: Sat, 28 Jul 2001 01:55:13 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Flock on DATA?
Message-Id: <3B6253C1.276F9788@earthlink.net>

I'm not sure how well this would work, but... if a particular file (say,
a DB file) is only being accessed from one module, could we simply lock
the DATA filehandle within that module, rather than creating something
*just* to be a lockfile?  After all, if DATA is the filehandle of the
module, and only one instance of perl, with that module, is supposed to
be accessing the DB, then we should be all set.

Plus, this would mean that we eliminate the need to remove our lockfiles
later.

-- 
I need more taglines. This one is getting old.


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

Date: Sat, 28 Jul 2001 12:30:00 GMT
From: AvA <a.v.a@home.nl>
Subject: hash
Message-Id: <3B62B322.2085966F@home.nl>

Hello all,

I am trying to make a multidimensional has from an array.
Here is what I have so far, which obviously just keeps the last element
(i.e. test2.pl).

@array = qw(test.pl test2.pl);

foreach $i (@array){
        %hash = ( 'files' => [
                                            {
                                            'name' => $i,
                                            'size' => (-s $i)
                                           }
                                           ]
        );
}

print $hash{files}->[0]->{name};


Any help apreciated.



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

Date: 28 Jul 2001 12:49:31 GMT
From: ebohlman@omsdev.com (Eric Bohlman)
Subject: Re: hash
Message-Id: <9juccr$kjn$2@bob.news.rcn.net>

AvA <a.v.a@home.nl> wrote:
> Hello all,

> I am trying to make a multidimensional has from an array.
> Here is what I have so far, which obviously just keeps the last element
> (i.e. test2.pl).

> @array = qw(test.pl test2.pl);

> foreach $i (@array){
>         %hash = ( 'files' => [
>                                             {
>                                             'name' => $i,
>                                             'size' => (-s $i)
>                                            }
>                                            ]
>         );
> }

Don't re-initialize the hash each time through the loop.  Rather, push 
your new sub-hash onto the array referenced by your main hash key:

foreach $i (@array) {
  push @{$hash{files}},
    {
     'name' => $i,
     'size' => (-s $i)
    };
}

Autovivification guarantees that your array reference will be properly 
created the first time around.



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

Date: 28 Jul 2001 07:39:13 +0100
From: nobull@mail.com
Subject: Re: How to use setuid in perl?
Message-Id: <u9zo9pv9pq.fsf@wcl-l.bham.ac.uk>

ftp <shyan@cse.cuhk.edu.hk> writes:

> I don't know how to use setuid in Perl.

See perldoc and the descriptions of the $< $> $( $} variables in
perlvar.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: 28 Jul 2001 10:51:14 GMT
From: ftp <shyan@cse.cuhk.edu.hk>
Subject: Re: How to use setuid in perl?
Message-Id: <9ju5f2$e5u$3@eng-ser1.erg.cuhk.edu.hk>

nobull@mail.com wrote:
> ftp <shyan@cse.cuhk.edu.hk> writes:

>> I don't know how to use setuid in Perl.

> See perldoc and the descriptions of the $< $> $( $} variables in
> perlvar.

where can I find perldoc and perlvar?

> -- 
>      \\   ( )
>   .  _\\__[oo
>  .__/  \\ /\@
>  .  l___\\
>   # ll  l\\
>  ###LL  LL\\

-- 


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

Date: Sat, 28 Jul 2001 15:07:00 +0200
From: Philip Newton <pne-news-20010728@newton.digitalspace.net>
Subject: Re: How to use setuid in perl?
Message-Id: <kjd5mt0ncuhf0q0drkhdajg4olkclhrrrb@4ax.com>

On 28 Jul 2001 10:51:14 GMT, ftp <shyan@cse.cuhk.edu.hk> wrote:

> where can I find perldoc and perlvar?

If you have Perl properly installed, then typing

    perldoc perlvar

at the command prompt (perhaps '%' or '$' or 'C>' or (hopefully not)
'#') should show you the perlvar document.

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 28 Jul 2001 08:20:36 +0100
From: nobull@mail.com
Subject: Re: Optimization Question
Message-Id: <u9r8v1v7sr.fsf@wcl-l.bham.ac.uk>

Kevin Michael Vail <kevin@vaildc.net> writes:

> Subject: Re: Optimization Question

Please try harder.  Remeber that newsgroups are archived and that
subject lines are what appear as thread identifiers.

"Question" is implied in most subject lines.

"Optomisation" is not really what you are asking about. The two things
you are comparing have different semantics so the question as to
whether perl will optomise one into the other is moot.

Always ask yourself this: "When I did a Usenet search to see if my
question was already asked, had I seen my subject line come up would I
have recognised it as being the same question?".  If the answer is
"no" then your subject line is not good enough.

Would it really have been so hard to come up with something as
descriptive as:

Subject: proc(@$var) v. &proc($var) with (\@) prototype 

Note, if you didn't do a search before you posted ask yourself this:
"What does it say about me that I value my time so much more than the
time of the people I'm expecting to help me?"

> If $var is a reference to an array, and there is a subroutine &proc
> with a prototype of (\@), and I want to call &proc with $var as a
> parameter and still satisfy the prototype, it's necessary to do
> something like
> 
> proc(@$var);
> 
> which would be basically the same as &proc(\@$var).  Does the \@$var
> part get optimized back to $var, so that the latter is the same as
> &proc($var)?

No.

sub proc (\@);
&proc($var); # $var can be anything - passed directly
proc(@$var); # error unless $var is usable as ARRAY-ref

In the first case $_[0] within &proc will be an alias for $var.

In the second case $_[0] will be an read-only copy of $var.

This is unlikely to be significant unless $var is global.

If $var is an ARRAY-ref then there's essentially no difference except
speed and that will be small - no copy of the array itself is created.

If $var is undef then in the second case it will be autovivified into
an ARRAY-ref but in the first it won't.

If $var is a reference to an object of a class that overloads @{} then
in the first case proc will be passed a reference to the object but in
the second it will be passed the result of calling the @{} overload method.

To measure performance impact of this use Benchmark.

If you care about speed that much you probably shouldn't be using Perl.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


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

Date: Sat, 28 Jul 2001 10:00:25 +0100
From: John Nurick <jnurick@zdnetonebox.com>
Subject: Re: Re: Regular Expression
Message-Id: <3jo4mt4j4slpdfq0hjstm0imqu8c3d9oum@4ax.com>

On Fri, 27 Jul 2001 13:29:49 +0100, "Lee Osborne"
<osbornelee@hotmail.com> wrote:

>OK heres a solution!
>
>$input = "12a3456";
>$idLengthIn = length($input);
>if ($input{'document_id'} =~ /\d{$idLengthIn}/) {
>   print "Digits ONLY!";
>}
>else {
>   print "Not just digits!";
>}

I spent ages trying understand how this could possibly work and what
might be magic about %input. 

Then I tested it and found that it doesn't work as it stands after
all. Phew! 

--
John

Please reply to the newsgroup and not by e-mail.
split $q,q[ acehJklnoPrstu]; $q.=$_[$_] for map hex, unpack
q,a,x29,q;89D010B3170A3B7041263B01D0177;;print qq;...$q.\n;


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

Date: Sat, 28 Jul 2001 08:42:19 GMT
From: "John P" <john@trumpetweb.co.uk>
Subject: SHEBANG ?
Message-Id: <LVu87.3783$o_.540789@news1.cableinet.net>

Hi there,

Can anyone shed any light on the standard locations of perl ie what should
be put in the SHEBANG line? I'm not talking about custom perl installations,
just the normal stuff on most systems.

I've got #!/usr/bin/perl and #!/usr/local/bin/perl

Presumably there are others?

Thanks in advance

John




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

Date: Sat, 28 Jul 2001 01:38:23 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Single char formats => core dump?!?
Message-Id: <3B624FCF.8B2E33BE@earthlink.net>

Has anyone submitted a bugreport on this?  If not, I have a slightly
smaller piece of code which shows off the error:

sub formtest {
  my $cnt = shift;
  my $fmt = "format STDOUT =\n" . ("^" x $cnt) . "\n" .
  join(",", map "\$a{$_}", 1..$cnt) . "\n.\n";
  print STDERR $fmt;
  eval $fmt;
  write; # it's write, not eval, which dies.
}

my $i = $ARGV[0]+0;
formtest( $i++ ) while(1);
__END__

-- 
I need more taglines. This one is getting old.


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

Date: Sat, 28 Jul 2001 12:27:29 GMT
From: "Killiam" <Killiam@hotmail.com>
Subject: Striping out the string
Message-Id: <Rcy87.17540$UH6.3293635@news02.optonline.net>

Hi Group

 I'm tying to strip out everything but a file extension of a variable "$file
= c:\files\file.exe" and I what to end up with a variable of "$file = .exe"
I try $file =~ s/\.[^.]+$//; and that will strip out the ".exe" So shouldn't
$file =~ s/\.[$.]+$//; strip out the "c:\files\file"

Thanxs in advance




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

Date: Sat, 28 Jul 2001 14:36:32 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Stripping extention from a filename in a string
Message-Id: <3B62B1D0.2070901@post.rwth-aachen.de>

Godzilla! wrote:

>Irrelevant. Your comments do not comply with the
>originating author's stated parameters.
>
Bogus. He said he wanted to remove extensions. He did _not_ say with one 
single word that the extension would always consist of three letters. 
The parameters as stated by the author were really just an example by 
chance containing extensions with three letters.
[ ] You kow the meaning of 'abstraction'

>I find your articles to be consistently a detriment
>to this group. You serve no beneficial purpose here.
>

While you only provide us with scripts that rather resemble qbasic than 
Perl, but - interestingly enough - only in those case where you think 
the task could be solved by involving substr or r?index.


Tassilo



-- 
"Dump the condiments.  If we are to be eaten, we don't need to taste good."
-- "Visionaries" cartoon




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

Date: Sat, 28 Jul 2001 01:42:31 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: What am I doing wrong with this command line ?
Message-Id: <3B6250C7.D217D05D@earthlink.net>

test@localhost.localdomain wrote:
> 
> Ken Laird wrote:
> 
> > ls -la
> >
> > file1
> > file2
> > file3
> > file4
> >
[snip]

> [test@localhost /tmp]% mkdir z
> [test@localhost /tmp]% cd z
> [test@localhost /tmp/z]% touch file1 file2 file3
> [test@localhost /tmp/z]% ls -la
> total 8
> drwxr-xr-x    2 test     users        4096 Jul 27 01:52 .
> drwxrwxrwt    6 root     root         4096 Jul 27 01:51 ..
> -rw-r--r--    1 test     users           0 Jul 27 01:52 file1
> -rw-r--r--    1 test     users           0 Jul 27 01:52 file2
> -rw-r--r--    1 test     users           0 Jul 27 01:52 file3

You're confusing the 1 flag (number one) with the l flag (lowercase
letter L).

-- 
I need more taglines. This one is getting old.


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

Date: Sat, 28 Jul 2001 01:46:43 -0400
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: What am I doing wrong with this command line ?
Message-Id: <3B6251C3.8EF9E8B@earthlink.net>

Ken Laird wrote:
> 
> ls -la
> 
> file1
> file2
> file3
> file4

That's not right... it should include . and .. because of the -a.  What
OS are you on?

> I'd like to get the next line if /file2/ matches.
> 
> So I'm trying something like this
> 
> perl -e 'for (`ls -la`) {next if /file2/;print}'
> 
> but it doesn't work.

Define "doesn't work."  Prints errors?  Prints nothing?  Prints
something, but not what you want?  What?

> I tried with shift instead of next , but doesn't work either.
> 
> What am I doing wrong?

You should probably use qx instead of backticks when trying to do
oneliners.  Whether or not this will fix it depends on your shell.

perl -e 'for (qx[ls -la]) { next if /file2/; print }'

-- 
I need more taglines. This one is getting old.


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

Date: Sat, 28 Jul 2001 10:37:25 +0200
From: Philip Newton <pne-news-20010728@newton.digitalspace.net>
Subject: Re: Who can help me about the confused (..) operator?
Message-Id: <2pt4mts8ttv72c6qg7m9pvtgknddqujbq9@4ax.com>

On Sat, 28 Jul 2001 09:03:08 +0800, MMX166+2.1G HD <no@mail.addr> wrote:

> which newsreader do you use?

The same as you -- Forte Agent 1.8/32.548.

The cursor starts at the top so that you can start snipping irrelevant
stuff away, not so you can start typing there. At least, that's my
theory :)

(PS: You get even more bonus points for snipping signatures when
replying -- Agent should do that automatically for you if the signature
is properly delimited; at least it does for me.)

Cheers,
Philip
-- 
Philip Newton <nospam.newton@gmx.li>
That really is my address; no need to remove anything to reply.
If you're not part of the solution, you're part of the precipitate.


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.  

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


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