[17763] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 5183 Volume: 9

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Dec 22 18:05:29 2000

Date: Fri, 22 Dec 2000 15: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: <977526308-v9-i5183@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 22 Dec 2000     Volume: 9 Number: 5183

Today's topics:
    Re: changing file permission <francis@contessa.u-net.com>
    Re: changing file permission <francis@contessa.u-net.com>
        chdir and UNC path arysul@my-deja.com
    Re: chdir and UNC path nobull@mail.com
    Re: chdir and UNC path arysul@my-deja.com
        compiler <chrina@forthnet.gr>
    Re: Convert YM to YMD Where D Is Last D of M Using Date <monty@primenet.com>
    Re: dynamically looding perl.modules <c-ron.rohrssen@wcom.com>
        file size - outside url? <karol@imm.org.pl>
    Re: how to install a module (a newby on modules) <karol@imm.org.pl>
    Re: IDE for development in perl <danny@lennon.postino.com>
    Re: Is there a standard, current Perl for Win32 (withou <abe@ztreet.demon.nl>
    Re: Looking for a Canadian PERL/CGI programmer (David H. Adler)
    Re: Looking for a Canadian PERL/CGI programmer <willem@veenhoven.com>
    Re: Looking for a Canadian PERL/CGI programmer <smerr612@mailandnews.com>
    Re: netiquette checking script <smerr612@mailandnews.com>
    Re: opensource C/C++ compiler for Win32? <danny@lennon.postino.com>
        Problem sending Secure HTTP request <ryanmh_99@yahoo.com>
    Re: problem with awk in perl script <anmcguire@my-deja.com>
    Re: Reading a Directory Listing into an Array <Pfeiffer.Hans@talknet.de>
    Re: Reverse "append to file" <cyner.mail@sweden.com>
    Re: vec seems to need a tmp in my .pm file?? nobull@mail.com
    Re: Why are multiple zeroes true? <ddunham@redwood.taos.com>
        Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)

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

Date: Fri, 22 Dec 2000 21:29:01 +0000
From: Francis Woodhouse <francis@contessa.u-net.com>
Subject: Re: changing file permission
Message-Id: <3A43C79D.DD65C2F4@contessa.u-net.com>


If you want to set permissions, then the chmod command is a UNIX
command. If the server you are using is UNIX (it'd have to be if you're
changing permissions) then try this:
system("chmod 0777,$filename");
If $filename is getting input by a user somehow then you may want to use
this for
security reasons:
system("chmod", "0777", $filename);
This bypasses the shell and forces the arguments to be strictly to
chmod. This stops someone setting $filename (through input) as something
like:
; cd /; rm -rf *.*
resulting in the server getting
chmod 0777; cd /; rm -rf *.* $filename
This would delete everything on the server successfully.

Francis Woodhouse



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

Date: Fri, 22 Dec 2000 21:32:38 +0000
From: Francis Woodhouse <francis@contessa.u-net.com>
Subject: Re: changing file permission
Message-Id: <3A43C876.3A7C10E6@contessa.u-net.com>

SORRY! A few errors crept in there (getting mixed up with UNIX chmod and
Perl chmod)

Francis Woodhouse wrote:

> If you want to set permissions, then you could try the UNIX chmod command.
> If the server you are using is UNIX (it'd have to be if you're
> changing permissions) then try this:
> system("chmod 0777,$filename");

Shoud be system("chmod $filename 0777");

>
> If $filename is getting input by a user somehow then you may want to use
> this for
> security reasons:
> system("chmod", "0777", $filename);

Whoops! That should be
system("chmod", $filename, "0777");

>
> This bypasses the shell and forces the arguments to be strictly to
> chmod. This stops someone setting $filename (through input) as something
> like:
> ; cd /; rm -rf *.*
> resulting in the server getting
> chmod 0777; cd /; rm -rf *.* $filename

Should be chmod; cd/; rm -rf *.* $filename 0777

>
> This would delete everything on the server successfully.
>
> Francis Woodhouse



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

Date: Fri, 22 Dec 2000 19:32:27 GMT
From: arysul@my-deja.com
Subject: chdir and UNC path
Message-Id: <920a8c$nk6$1@nnrp1.deja.com>

I tried to use chdir() with UNC path.
It appears that chdir() does not support UNC path.

Is there a way around this? I'd like to use UNC path.

thanks
Ary


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


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

Date: Fri, 22 Dec 2000 19:49:59 GMT
From: nobull@mail.com
Subject: Re: chdir and UNC path
Message-Id: <920b96$of7$1@nnrp1.deja.com>

In article <920a8c$nk6$1@nnrp1.deja.com>,
  arysul@my-deja.com wrote:
> I tried to use chdir() with UNC path.
> It appears that chdir() does not support UNC path.

Appearences can be deceptive.

> Is there a way around this?

Unless you tell us how it is that you are percieving the false
appearance that chdir() doesn't support UNC patch we can't do much to
help you avoid doing it.


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


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

Date: Fri, 22 Dec 2000 20:23:39 GMT
From: arysul@my-deja.com
Subject: Re: chdir and UNC path
Message-Id: <920d85$q2b$1@nnrp1.deja.com>

Thanks for the reply.
After reading your reply and re-reading the error msg I got,
I think the problem is not with chdir() and UNC.

The following is a simplified version of my script.
After changing directory, I am trying to invoke a batch file
(which will in turn invoke cmd.exe)

This is the error message I got:
CMD.EXE was started with '\\rbubld05red\SharedDir' as the current
directory path.  UNC paths are not supported.  Defaulting to Windows
directory.


Code snippet:

===== start =====

use Net::Domain qw(hostname);

my $workdir = "\\\\" . hostname() . "\\SharedDir";
chdir("$workdir");
system ("mybatch.bat");   # this is where it failed.

=== end ====


Ary



In article <920b96$of7$1@nnrp1.deja.com>,
  nobull@mail.com wrote:
> In article <920a8c$nk6$1@nnrp1.deja.com>,
>   arysul@my-deja.com wrote:
> > I tried to use chdir() with UNC path.
> > It appears that chdir() does not support UNC path.
>
> Appearences can be deceptive.
>
> > Is there a way around this?
>
> Unless you tell us how it is that you are percieving the false
> appearance that chdir() doesn't support UNC patch we can't do much to
> help you avoid doing it.
>
> Sent via Deja.com
> http://www.deja.com/
>


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


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

Date: Fri, 22 Dec 2000 18:23:58 +0200
From: "chrisain" <chrina@forthnet.gr>
Subject: compiler
Message-Id: <977502248.367712@athnrd02.forthnet.gr>

is there a program / compiler for win that turns perl scripts in .exe mode
?thanx in advance




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

Date: 22 Dec 2000 21:13:51 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: Convert YM to YMD Where D Is Last D of M Using Date::Manip
Message-Id: <920g6f$9s1$1@nnrp1.phx.gblx.net>

Logan Shaw <logan@cs.utexas.edu> wrote:
> Jim Monty <monty@primenet.com> wrote:
> > Hey, since we're on the subject... Is it a Bad Thing to do this?
> >
> >     @last = (0, 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
> >
> > It's hard to image the value of C<scalar @last> or C<$#last> ever
> > being of much use anyway. And using a placeholder for the purpose
> > of aligning the date values with their proper ordinal subscripts
> > saves arithmetic, right?
>
> Not only does it save arithmetic, but it's quite possible that rather
> than wasting space, it actually saves space.  I don't know Perl
> internals, but the subtraction of a one must be represented when perl
> compiles your code into its internal representation.  I'd bet that the
> representation for a subtraction and a constant together are larger
> than the additional space needed to store one extra array element.
>
> Then there is the point of view that it might actually be clearer code
> if you assign to the range that makes sense naturally:
>
> 	@last[1..12] = qw{ 31 0 31 30 31 30 31 31 30 31 30 31 };
>
> It's a little less efficient, ...

But it's a O(1) operation, so it's arguably not really less efficient.

> ... but it sort of makes more sense to look at, because it ignores
> the question of where arrays begin and explicitly states what
> you want the array indices to mean.

Indeed.

Here's the code that I'm using in my script:

BEGIN {
    my @last_day_of_month;
    @last_day_of_month[1..12] = qw{ 31 0 31 30 31 30 31 31 30 31 30 31 };

    sub append_last_day_of_month {
        my ($year, $month) = @_[0, 1];
        return "$year$month" . ($last_day_of_month[$month] ||
                               ($year %   4 ? "28" :
                                $year % 100 ? "29" :
                                $year % 400 ? "28" : "29"));

    }
}

By the time I call &append_last_day_of_month, I've already had to
match the date string and parse it into year and month values.

Thanks for the suggestions, everyone.

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Fri, 22 Dec 2000 20:58:37 GMT
From: "Ron Rohrssen" <c-ron.rohrssen@wcom.com>
Subject: Re: dynamically looding perl.modules
Message-Id: <1gP06.102$rm4.2120@pm01news.wcom.com>

I came across an excellent discussion on just such a topic at
http://agni.csa.iisc.ernet.in/~ksvivek/perl5/chap14.htm. Look within this
page for "root" and you can see an easy example of how this is set using
"use".


"Thomas Schindl" <tomAtLinux@gma.at> wrote in message
news:3A3A7F7E.2060301@gma.at...
> Hy newsgroup,
>
> does anybody know how I can load perl-modules at run time? I know that
> the following example won't work it should only illustrate my problem.
>
> --------------cut---------------
> my @perlArray=(
>          "module1",
>          "module2"
>             );
>
> if($status == 1)
> {
>     use $perlArray[0];
> }
> else
> {
>     use $perlArray[1];
> }
>
> --------------cut----------------
>
> Is loading perl-modules at runtime possible? Can anybody help me?
>
> Thanks
>
> Tom
>




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

Date: Fri, 22 Dec 2000 22:45:51 +0100
From: "Karol Nowakowski" <karol@imm.org.pl>
Subject: file size - outside url?
Message-Id: <3a43cb97$1@news.home.net.pl>

to check the size of the file I'm normally useing:

$urlzd = "file.txt";
$w = -s "$urlzd";

$w  ---> file size

but when I wan't:
$urlzd = "http://www.server.com/catalogue/catalogue/file.txt";
it doesn't work

Is there any posiibility for this to work?

please help

Best Regards,
Karol Nowakowski




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

Date: Fri, 22 Dec 2000 21:11:14 +0100
From: "Karol Nowakowski" <karol@imm.org.pl>
Subject: Re: how to install a module (a newby on modules)
Message-Id: <3a43b56a$1@news.home.net.pl>

Użytkownik "Tad McClellan" <tadmc@metronet.com> napisał w wiadomości
news:slrn947087.7ta.tadmc@magna.metronet.com...
> Karol Nowakowski <karol@imm.org.pl> wrote:
> >I don't even know where to start.
>    perldoc perlmodinstall
thanks
I've read, but
I still don't know where to write all this commands.
My computer is on Win Millenium
But where do I wan't install a module is the virtual server by my ISP with
Unix OS
do I have to connect with a telnet to put all this commands?


> >I've read lot's of messages on newsgroups,
> >some tutorials and faqs but I still don't know what to do.
> Have you seen this Perl FAQ:
>    "How do I keep my own module/library directory?"
> It tells you how to install modules without being root.

If it is going about:
http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq8/How_do_I_keep_my_own_mod
ule_library_directory_.html
I went through this but I still couldn't find answer to my question.

Not only I'm not the root, but even the computer in front which I'm now
sitting is not the one, I want to install module on.

please help
Best Regards,
Karol Nowakowksi




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

Date: Fri, 22 Dec 2000 19:40:11 GMT
From: Danny Aldham <danny@lennon.postino.com>
Subject: Re: IDE for development in perl
Message-Id: <920an4$fhe$1@lennon.postino.com>

Otto Wyss <otto.wyss@bluewin.ch> wrote:
> Is there any useful IDE for development in perl (platform WindowsNT) or
> does everyone just use a simple text editor?
> If there is no IDE what's the best editor?
> O. Wyss

Activestate have just released a new version of there Komodo product,
an ide for perl & python. It uses Mozilla as the base platform, and 
Activestate have some great perl people on staff. They have both an 
NT and a Linux version, but the Linux version keeps core dumping on me.
YMMV. Give it a try from www.activestate.com .

-- 
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP & Perl


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

Date: Fri, 22 Dec 2000 20:29:51 +0100
From: Abe Timmerman <abe@ztreet.demon.nl>
Subject: Re: Is there a standard, current Perl for Win32 (without ActivePerl?)
Message-Id: <v6774tkmal7ju8jrc87s8dlllj79b3emvg@4ax.com>

On Fri, 22 Dec 2000 08:36:30 -0800, John Nagle <nagle@animats.com>
wrote:

> "Philip 'Yes, that's my address' Newton" wrote:
> > On Thu, 21 Dec 2000 12:26:02 -0800, John Nagle <nagle@animats.com> wrote:
> > >   Is there a current, standard (binary) version of Perl for Win32?
> > Seriously, though -- what's wrong with compiling your own?
> 
>     I could, but then I'd have a nonstandard binary.  
> Also, I use MSVC++ 5.x, and Perl is usually built with 
> gcc or Borland compilers.  I hate to download and install
> another development environment just to build Perl.

You didn't really read the README.win32 that comes with the source
distribution, did you? This is from the, well ehrr..., ActiveState
source distribution (AP616):

    Currently, this port is capable of using one of the following
    compilers:

       Borland C++               version 5.02 or later
       Microsoft Visual C++      version 4.2 or later
       Mingw32 with GCC          version 2.95.2 or better

 ...

>           Is Microsoft pressuring people to avoid distributing
> pure Perl binaries?

You haven't read the information from ActiveState either. You can just
install the Win32 port of Perl and leave Perl-ISAPI and PerlScript where
they are (in the installation file :).

There is even a binary distribution available from ActiveState for
people that can't/won't install MSInstaller.

[ and from another post in this thread ]
>     ActivePerl also encourages the development of future Perl
> packages which have undesirable Windows dependencies, which was
> probably Microsoft's intention when they put money into ActiveState.  

IMHO you are mistaken about the role of M$ in the Perl development at
ActiveState. I for one like the fact that an effort has been made to
implement fork() on Win32.

The fact that a Win32 distribution comes with the Win32::* module
hierarchy shouldn't be a problem, if you don't want to use them, remove
them. They are like a lot of (XS)modules, a Perl interface to _a_ system
or set of libraries.

[ ... and ... (now off-topic) ]
>                        Also, to install ActivePerl, you have to obtain
> and install a new version of Internet Explorer and an NT service pack,
> always risky activities.

My NT-box doesn't have a (new) Internet Explorer, and runs with
ServicePack 4 just fine. ActivePerl will install and run fine under
those minimum conditions. (I don't know why they say those things.)

You should make up your mind whether you want the 'convenience' of a
binary distribution --with a selection of XS modules ready to install--
or build your own perl the way you want it and having to 'hunt' for the
right libraries to build your own XS modules.

-- 
Good luck,
Abe
perl -wle '$_=q@Just\@another\@Perl\@hacker@;print qq@\@{[split/\@/]}@'


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

Date: 22 Dec 2000 20:55:29 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Looking for a Canadian PERL/CGI programmer
Message-Id: <slrn947fu1.5kq.dha@panix2.panix.com>

On Thu, 21 Dec 2000 15:14:36 GMT, ignition78@my-deja.com wrote:

>Hi, I am not sure if this is the right forum, but it is a misc forum,
>so here goes:

Nope, sorry.

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/
"Perhaps *the* Monty Python Scholar in America today"
	-New Yorker magazine 13mar89


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

Date: Fri, 22 Dec 2000 22:32:08 +0100
From: willem veenhoven <willem@veenhoven.com>
Subject: Re: Looking for a Canadian PERL/CGI programmer
Message-Id: <3A43C858.3E1D20CA@veenhoven.com>

"David H. Adler" wrote:
> 
> On Thu, 21 Dec 2000 15:14:36 GMT, ignition78@my-deja.com wrote:
> 
> > Hi, I am not sure if this is the right forum, but it is a misc
> > forum, so here goes:
> 
> Nope, sorry.

Are you a robot of any kind? Saw the same response before ...

willem


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

Date: Fri, 22 Dec 2000 22:11:30 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: Looking for a Canadian PERL/CGI programmer
Message-Id: <920jie$v3g$1@nnrp1.deja.com>

In article <3A43C858.3E1D20CA@veenhoven.com>,
  willem veenhoven <willem@veenhoven.com> wrote:
> "David H. Adler" wrote:

<SNIP DHA's Normal response to Job Postings>

> Are you a robot of any kind? Saw the same response before ...

Nope. DHA is a real flesh and blood person who knows how to cut-n-paste.
He's been using that reply for as long as I can remember.  It's well
stated and polite. No reason to change it and no reason to re-type it.
I've done the same thing myself on occasion to discourage trolls or
spammers.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


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


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

Date: Fri, 22 Dec 2000 19:56:42 GMT
From: Steven Merritt <smerr612@mailandnews.com>
Subject: Re: netiquette checking script
Message-Id: <920blo$olo$1@nnrp1.deja.com>

In article <3a42646e@cs.colorado.edu>,
  tchrist@perl.com (Tom Christiansen) wrote:
> We really need shared or cooperative {score,kill}files.  I'm thinking
> of some dynamic solution to the noiseboxes, maybe reminiscent of
> Greg Bacon's periodic stats postings.  I'll likely start with
> something like this.

I'm not sure how you would implement this, actually, it's pretty clear
how you would implement it, what I really mean is how you would use
this. Would it be a bot which would analyze traffic and post summary
messages like Greg's stats?  Or would we each be able to download it and
run it as an agent to help set our scores?  I don't believe you are
considering letting this thing post individual analyses of each message
as follow-ups to those messages.  That would be ludicrous.  The bot
would immediately land in more killfiles than any annoying poster, even
Godzilla!.

I would rather have this program available to help me automate the
setting of my scorefile than have it ever post to the group.  Then I can
set my own standards for "netiquette"  i.e. how much quoted/original
material is acceptable.  This is an unmoderated group, and I would much
rather it stay an unmoderated group than have a couple of bots running
around either answering questions or running newbies through a filter to
decide if they're worthy of our help.

Steven
--
King of Casual Play
The One and Only Defender of Cards That Blow


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


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

Date: Fri, 22 Dec 2000 20:02:10 GMT
From: Danny Aldham <danny@lennon.postino.com>
Subject: Re: opensource C/C++ compiler for Win32?
Message-Id: <920c22$fu9$1@lennon.postino.com>

John Nagle <nagle@animats.com> wrote:
>    That's great!  For those of us who don't want the ActiveState
> version of Perl, this is needed.  Keep us posted on how this goes.
> You might want to distribute the result on SourceForge.
> Right now, there's no win32 binary for standard Perl.  The
> ActiveState version has lots of Microsoft-specific extensions and
> requires IE 5, etc, so it's not a standard distribution.

Hmmmm. Before Activestate the perl distribution for Win32 vs 
everyone-else, had forked. It was under the direction of 
Gurusamy Sarathy, the last pumpking and Activestate employee, that the 
two were merged. 
While Dick Hardt does sometimes come across as thinking his poop don't
stink, Activestate are doing some good work and should be commended.
If you have ever stuggled with building perl from scratch with the
Cygwin tools, you have to agree.

-- 
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP & Perl


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

Date: Fri, 22 Dec 2000 19:30:07 -0000
From: Ryan <ryanmh_99@yahoo.com>
Subject: Problem sending Secure HTTP request
Message-Id: <t47atvi4emshf3@corp.supernews.com>

I can't seem to get either the LWP or Net::SSLeay secure HTTP requests to 
be successful.

CODE 1: Net::SSLeay

use Net::SSLeay qw(get_https post_https sslcat make_headers make_form);
  ($page, $response, %reply_headers)
  = get_https
('https://secureserver.net',443, '/path/to/CGI',                 
         make_headers('Key'  => 'Value',
                      'Key2' => 'Value'));

  No matter what secure server I use it can never find the destination.  I 
know their valid becuase I've sent data there before.

CODE 2: LWP

use IO::Socket::SSL;
use LWP::Protocol::https;
use LWP::UserAgent;
         $ua = new LWP::UserAgent;
         $ua->agent("AgentName/0.1 " . $ua->agent);

         # Create a request
         my $req = new HTTP::Request POST => 'https://secure.server.net;
         $req->content_type('application/x-www-form-urlencoded');
         $req->content('match=www&errors=0');

         # Pass request to the user agent and get a response back
         my $res = $ua->request($req);

I can get this code to work for HTTP requests but not HTTPS requests.  The 
is_success is a failure.  Whats wrong with it??

  Thanks



--
Posted via CNET Help.com
http://www.help.com/


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

Date: Fri, 22 Dec 2000 22:29:20 GMT
From: Andrew N McGuire <anmcguire@my-deja.com>
Subject: Re: problem with awk in perl script
Message-Id: <920kjq$vmv$1@nnrp1.deja.com>

In article <t477rpqoec17b5@corp.supernews.com>,
  Chris Stith <mischief@velma.motion.net> wrote:
>
> Andrew makes a good point. However, he didn't point out
> that the backtick isn't just a quote in Perl.

  Actually, I pointed it out...  by correcting it, perhaps I should
have been more explicit.

> In comp.lang.perl.misc Andrew N. McGuire <anmcguire@ce.mediaone.net>
wrote:
> >>>>>> "NL" == Nikos Laoutaris <laoutaris@di.uoa.gr> writes:
>
> > NL> system(`awk '{print $10,$1}' statdata.dat `);
>
> Here you are calling system with the return value of
> your awk program. This is similar to the following:
>
> $call = `awk '{print $10,$1}' statdata.dat `;
> system("$call");
         ^     ^
       superfluous

> You can verify this by running the two test programs
> below:
>
> ############# prog1
> system(`echo foo!`); # echos nothing
>
> ############# prog2
> system(`echo echo foo!`); # echos 'foo!' because of the second echo
>
> What the OP really wants to do (other than to use Perl without awk,
> that's already been mentioned, may not be optimal in the OP's
> situation, and sounds a bit elitist although accurate) is to either
> use the backticks without system() or to use system() without the
> backticks.

It may be elitist, but surely one would not need to resort to
exteral programs, when Perl is perfectly capable of doing what
he wants.  Now, there are cases where the use of an external
program is warranted, or even the best thing to do.  Sorting
springs to mind quickly as an example.  I cannot think of a
reason for calling awk in such a manner, perhaps a benchmark
would expose me as wrong.

> system('awk \'{print $10,$1}\' statdata.dat '); # this should work
> `awk '{print $10,$1}' statdata.dat `; # this should work

The FAQ points out why backticks in a void context are a not so
good idea.

> The OP probably also wants to check / use the return values on such
> calls.
>
> $result = system('programtocall and arguments');
> $result = `programtocall and arguments`;

Or even:

  system(@args) == 0
    or die "system @args failed: $?\n";

as pointed out in the perlfunc(1) manpage...

anm

--
$ENV{PAGER} = 'perl -wpe0';
system perldoc => '-t', '-F', $0;

=head1 Just Another Perl Hacker


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


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

Date: Fri, 22 Dec 2000 23:02:52 +0100
From: Hans-Friedrich Pfeiffer <Pfeiffer.Hans@talknet.de>
Subject: Re: Reading a Directory Listing into an Array
Message-Id: <3A43CF8C.20253222@talknet.de>


Try the following :

@Files = `ls $YourPathYouWantToExamine`;

Note : use ` and NOT ' !!!

Hans






Some_Indiana_Guy wrote:
> 
> Does anyone know a simple function to read a directory listing into an
> array?
> (using FreeBSD)


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

Date: Fri, 22 Dec 2000 22:12:48 GMT
From: chr1st1an <cyner.mail@sweden.com>
Subject: Re: Reverse "append to file"
Message-Id: <3A43D12E.8030000@sweden.com>

Joe Schaefer wrote:

> % man perldoc
> % perldoc -q insert

Well, if I had Linux or a manual of any kind I'd look there first. I'm 
new to Perl, not an idiot. You may want to change your attitude towards 
newbies.

-- 
|
|      chr1st1an
|      cyner.mail@sweden.com
|



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

Date: Fri, 22 Dec 2000 20:09:29 GMT
From: nobull@mail.com
Subject: Re: vec seems to need a tmp in my .pm file??
Message-Id: <920cdk$pei$1@nnrp1.deja.com>

In article <3a447403.89454067@news.tcn.net>,
  rzilavec@tcn.net wrote:

>	$hash{$num} = pack("b*", "0" x $total);

> 	vec($hash{$word}, $num, 1) = 1;

You problem is that one line you refer to $hash{$num} and on the other
$hash{word}


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


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

Date: Fri, 22 Dec 2000 19:31:05 GMT
From: Darren Dunham <ddunham@redwood.taos.com>
Subject: Re: Why are multiple zeroes true?
Message-Id: <ZZN06.15$4V2.38211@news.pacbell.net>

Michael Erskine <osiris@vast.urbanna.net> wrote:
> miko@idocs.com wrote:
>> 
>> In article <x7zohygpod.fsf@home.sysarch.com>,
>>   Uri Guttman <uri@sysarch.com> wrote:
>> 
>> > it all makes sense and you should trust larry's judgement on this.
>> > it has been this way for years and all experienced perl hackers
>> > know it and understand it. this question only comes from newbies
>> > who haven't learned enough perl yet.

> I am most certainly no perl wizard, but like Larry I am a linguist, and
> I am a Computer Scientist...  this foolishness of multiple 0's being true
> is not reasonable, period.

I can agree on some levels, but then I have some more questions.

1)  If it's not reasonable, and we want to specify a different line,
    where do we draw it?  Which of the following should be false?  Every
    one of them is false when compared numerically.

'0' 
'00'
'0000000'
'000000.000000'
'0.0.0'
'0 '   (trailing/leading space within the string)
'0e0'
'0e50'
'0e50.'
'0elvis'
'0_0._'
'(0)'
'+0'
'-0'

2)  Does this really bust folks much?   Any time I think I might be
    getting a string (because I'm reading a file rather than doing a
    calculation), I'll put in an explicit ($i != 0) test.

>> I do trust Larry's judgement, but it's hardly the path to the best world
>> to never question things.  As Larry says, "We question most of the
>> mantras around here periodically."

> Even so, it is Larry's design.  If he so chooses to make multiple 0's be
> true, he so chooses.  I am working with perl, still learning it actually,
> but I have never seen any other language (or reality for that matter) in
> which this is the case...

I've never worked with another language where you could ask for the
'truth' of a string.  

I can imagine that the 'right' way to do it would have been for the
string '0' to also be false, but that it's just too hard to guarantee
that you'll never stringify a false numeric 0.  If 'fixing' this were
easy, I guess I'd be all for it.  But I'd rather have '0' be true than
try to make some sort rule for why '00' is false.

> It is simply not reasonable.

It might not be reasonable to design that '0' be false and '00' be true
from the outset, but it might be entirely reasonable to have that
situation exist after other aspects of the language were developed.

Does it become more reasonable if you just say 'all strings of length
greater than zero are true, but '0' is an exception forced on us for
ease of other operations'?

-- 
Darren Dunham                                           ddunham@taos.com
Unix System Administrator                    Taos - The SysAdmin Company
Got some Dr Pepper?                           San Francisco, CA bay area
      < Please move on, ...nothing to see here,  please disperse >


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

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


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