[29946] in Perl-Users-Digest
Perl-Users Digest, Issue: 1189 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Jan 12 14:09:53 2008
Date: Sat, 12 Jan 2008 11:09:14 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 12 Jan 2008 Volume: 11 Number: 1189
Today's topics:
Applied Perl Source Code <llc00@doufu.shapes.com>
Applied Perl Source Code <>
Re: Converting milliseconds to seconds <nospam-abuse@ilyaz.org>
Re: Converting milliseconds to seconds <jurgenex@hotmail.com>
Re: csv data file, but with a twist <t.x.michaels@gmail.com>
Re: csv data file, but with a twist <jurgenex@hotmail.com>
Re: csv data file, but with a twist <rvtol+news@isolution.nl>
How can a non-privileged user find the NIC speeds? <Mark.Seger@hp.com>
Perl and C communication simone.romano82@gmail.com
Re: Perl and C communication <joost@zeekat.nl>
Re: Perl and C communication <rvtol+news@isolution.nl>
Re: Perl and C communication <jurgenex@hotmail.com>
Retrieving autoincrement field from SQLite using DBI <SteveSpamTrap@yahoo.com>
Re: Retrieving autoincrement field from SQLite using DB <glex_no-spam@qwest-spam-no.invalid>
Re: s/// does not affect pos? <tadmc@seesig.invalid>
Re: s/// does not affect pos? <ced@blv-sam-01.ca.boeing.com>
Simple "rm -rf"? <bernie@fantasyfarm.com>
Re: Simple "rm -rf"? <Peter@PSDT.com>
Re: Simple "rm -rf"? <abigail@abigail.be>
Re: Simple "rm -rf"? <snob@pense-mainz.eu>
Re: Simple "rm -rf"? <abigail@abigail.be>
Re: Simple "rm -rf"? <john@castleamber.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 12 Jan 2008 10:28:16 +0800
From: <llc00@doufu.shapes.com>
Subject: Applied Perl Source Code
Message-Id: <07ll55-3pu.ln1@doufu.shapes.com>
Hi,
Title: Applied Perl
Authors: Peter Williams
Publisher: M&T books
ISBN: 0764547836
I recently bought above book, I unable to download the source code, as
the site www.peterwilliams.net is no longer online. Could anyone point
me to another download link.
Thanks in advance.
LC
------------------------------
Date: Sat, 12 Jan 2008 10:20:29 +0800
From: "mydaj [ROR]" <>
Subject: Applied Perl Source Code
Message-Id: <168go3d8aem6ssjhroj07nrcqffo6uiph0@4ax.com>
Hi,
Title: Applied Perl
Authors: Peter Williams
Publisher: M&T books
ISBN: 0764547836
I recently bought above book, I unable to download the source code, as
the site www.peterwilliams.net is no longer online. Could anyone point
me to another download link.
Thanks in advance.
LC
------------------------------
Date: Sat, 12 Jan 2008 00:20:18 +0000 (UTC)
From: Ilya Zakharevich <nospam-abuse@ilyaz.org>
Subject: Re: Converting milliseconds to seconds
Message-Id: <fm9142$1t4b$1@agate.berkeley.edu>
[A complimentary Cc of this posting was sent to
Paul Lalli
<mritty@gmail.com>], who wrote in article <42484581-f7d1-4e75-b92f-c9ddcfe675c0@m34g2000hsf.googlegroups.com>:
> perldoc -f int
> int EXPR
> int Returns the integer portion of EXPR. If EXPR is
> omitted, uses $_. You should not use this function
> for rounding: one because it truncates towards 0,
> and two because machine representations of floating
> point numbers can sometimes produce counterintuitive
> results.
This is just a reflection of a sorry state of Perl documentation.
There is NO OTHER WAY to round-to-0 but to use int(). Yes, this may
produce counterintuitive results; NO, there is no better way.
Hope this helps,
Ilya
------------------------------
Date: Sat, 12 Jan 2008 00:54:57 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Converting milliseconds to seconds
Message-Id: <ik3go3pgkcrol2diigag1hl2prkke0ktt7@4ax.com>
Ilya Zakharevich <nospam-abuse@ilyaz.org> wrote:
>[A complimentary Cc of this posting was sent to
>Paul Lalli
><mritty@gmail.com>], who wrote in article <42484581-f7d1-4e75-b92f-c9ddcfe675c0@m34g2000hsf.googlegroups.com>:
>> perldoc -f int
>> int EXPR
>> int Returns the integer portion of EXPR. If EXPR is
>> omitted, uses $_. You should not use this function
>> for rounding: one because it truncates towards 0,
>> and two because machine representations of floating
>> point numbers can sometimes produce counterintuitive
>> results.
>
>This is just a reflection of a sorry state of Perl documentation.
>There is NO OTHER WAY to round-to-0 but to use int().
Your statement is non sequitur. int() does not an never was supposed to
round a number. If you expect int() to round a number then you are mistaken
about the semantic of this function.
> Yes, this may
>produce counterintuitive results; NO, there is no better way.
Well, there _are_ ways how to round a number in Perl, and because int()
doesn't round in the first place all of them are "better" than int().
>Hope this helps,
Hardly
jue
------------------------------
Date: Fri, 11 Jan 2008 15:32:35 -0800 (PST)
From: "t.x.michaels@gmail.com" <t.x.michaels@gmail.com>
Subject: Re: csv data file, but with a twist
Message-Id: <4362074d-fc79-4ff2-b7e7-539d931f7f2c@l1g2000hsa.googlegroups.com>
Try the following (I know, it's ugly and verbose, but it's me!)
grab everything between "==========" lines
========================================================================
#!/usr/bin/perl
use strict;
use warnings;
my $line;
my @fields;
my $desired_number_of_fields;
my $number_of_fields_read;
my $number_of_excess_fields;
while ( $line = <DATA> ) {
chomp $line;
@fields = split /,/, $line;
if ( $line =~ /^SKU/ ) {
$desired_number_of_fields = scalar @fields;
print "$line\n";
next;
}
$number_of_fields_read = scalar @fields;
if ( $number_of_fields_read == $desired_number_of_fields ) {
#No processing necessary
print "$line\n";
}
else {
$number_of_excess_fields
= $number_of_fields_read - $desired_number_of_fields + 1;
#Need to merge a few fields together, beginning with field 2
my @new_second_field
= splice @fields, 1, $number_of_excess_fields;
#Replace commas with space dash
my $new_second_field = join " -", @new_second_field;
#Put this new second field back into array
splice @fields, 1, 0, $new_second_field;
$line = join ",", @fields;
print "$line\n";
}
}
__DATA__
SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
0090 ,CUP-HOOK ,0012.34,0007.40,N,O, ,254-61,001
0110 ,HOOK ,0008.71,0006.53,Y,O, , ,001
0120 ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
0130 ,HOOK, RED ,0003.11,0002.33,N, , ,254-79 ,001
========================================================================
your output will be:
SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
0090 ,CUP-HOOK ,0012.34,0007.40,N,O, ,254-61,001
0110 ,HOOK ,0008.71,0006.53,Y,O, , ,001
0120 ,HOOK - TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
0130 ,HOOK - RED ,0003.11,0002.33,N, , ,254-79 ,001
is this what you want???
On Jan 11, 3:27 pm, nun <j...@yahoo.com> wrote:
> I have a comma-delimited text file (example data below). The problem is
> that *some* of the lines contain commas within the second field (named
> DESC) which is obviously a problem.
>
> I'd like to replace any such commas with a space followed by a hyphen.
>
> Actual sample data:
> SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
> 0090 ,CUP-HOOK ,0012.34,0007.40,N,O, ,254-61,001
> 0110 ,HOOK ,0008.71,0006.53,Y,O, , ,001
> 0120 ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
> 0130 ,HOOK, RED ,0003.11,0002.33,N, , ,254-79 ,001
>
> What I'd like to and up with:
>
> SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
> 0090 ,CUP-HOOK ,0012.34,0007.40,N,O, ,254-61,001
> 0110 ,HOOK ,0008.71,0006.53,Y,O, , ,001
> 0120 ,HOOK - TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
> 0130 ,HOOK - RED ,0003.11,0002.33,N, , ,254-79 ,001
>
> There *may* be lines which have more than one comma in the DESCR field.
> but luckily the 3rd field always has the format XXXX.XX (four digits,
> decimal, 2 digits)
>
> Can any suggest a hunk of code that will accomplish this? I've seen
> some "sed one liners" online that come close but so far no success.
> Thanks for any help!
>
> DB
------------------------------
Date: Sat, 12 Jan 2008 00:47:23 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: csv data file, but with a twist
Message-Id: <f73go3pmnhg7pt55rmk39b6npb5nfagger@4ax.com>
nun <junk@yahoo.com> wrote:
>I have a comma-delimited text file (example data below). The problem is
>that *some* of the lines contain commas within the second field (named
>DESC) which is obviously a problem.
Indeed, because that's not a CSV file any more. CSV allows enclosing those
fields with quotes, then you can have commata as data.
>I'd like to replace any such commas with a space followed by a hyphen.
>
>Actual sample data:
>SKU,DESC,LIST,COST,FLAG1,FLAG2,FLAG3,RELATED,FLAG4
>0090 ,CUP-HOOK ,0012.34,0007.40,N,O, ,254-61,001
>0110 ,HOOK ,0008.71,0006.53,Y,O, , ,001
>0120 ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
>0130 ,HOOK, RED ,0003.11,0002.33,N, , ,254-79 ,001
Just for fun because TIMTOWTDI:
- Extract the first field,
- reverse the remaining string,
- extract fields 7 to 3,
- whatever is left is field 2.
- reverse content of fields 2 to 7,
- process field 2,
- recombine fields 1-7
jue
------------------------------
Date: Sat, 12 Jan 2008 18:52:33 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: csv data file, but with a twist
Message-Id: <fmb2fn.1fo.1@news.isolution.nl>
nun schreef:
> Actual sample data:
> 0120 ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
>
> What I'd like to and up with:
> 0120 ,HOOK - TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
>
> There *may* be lines which have more than one comma in the DESCR
> field. but luckily the 3rd field always has the format XXXX.XX (four
> digits, decimal, 2 digits)
To start you off:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
my @data = split /((?<=,)[0-9]{4}[.][0-9]{2},)/, <DATA>, 2;
print Dumper \@data;
$data[0] = \@{[ split /\s*,/, $data[0], 2 ]};
$data[2] = \@{[ split /\s*,/, $data[2] ]};
print Dumper \@data;
__DATA__
0120 ,HOOK, TAPERED ,0004.57,0002.74,N,O, ,254-72 ,001
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 12 Jan 2008 08:24:43 -0500
From: Mark Seger <Mark.Seger@hp.com>
Subject: How can a non-privileged user find the NIC speeds?
Message-Id: <fmaf2t$n63$1@usenet01.boi.hp.com>
Does anyone know how to determine the NIC speed by non-privileged users?
I want to be able to do this from perl and can't find any data
structures in /proc and /sys, but then again there are an awful lot of
them and could be easy to miss in an obscure place. I usually use
ethtool for this but it requires privs.
-mark
------------------------------
Date: Sat, 12 Jan 2008 09:24:17 -0800 (PST)
From: simone.romano82@gmail.com
Subject: Perl and C communication
Message-Id: <04767f60-3589-4298-8fe6-7d7bc9818a4d@f47g2000hsd.googlegroups.com>
Hi
I'm new in Perl language...
I have an important question: Perl and C can communicate ?
My problem is the following: I have Perl script (client) that could
receive information ( via UDP connection) from a C program ( the
server).
Is it this possible? there are a method for client e server to
communicate??
Thanks in advance
Simo
------------------------------
Date: Sat, 12 Jan 2008 18:58:46 +0100
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: Perl and C communication
Message-Id: <878x2v9b8p.fsf@zeekat.nl>
simone.romano82@gmail.com writes:
> Hi
> I'm new in Perl language...
>
> I have an important question: Perl and C can communicate ?
>
> My problem is the following: I have Perl script (client) that could
> receive information ( via UDP connection) from a C program ( the
> server).
> Is it this possible? there are a method for client e server to
> communicate??
Yes it's possible and all the methods you'd need are in the perl base
language itself, though you may want to check out IO::Socket and friends
on search.cpan.org for a slightly easier to use interface.
The language that the server is written in or even the machine that it's
running on shouldn't make any difference. That's one of the points of
using sockets in the first place. If the data you're sending is in some
very complex binary format (instead of line-delimited text, for
instance) things could get a little more complicated - though it's still
very much possible to deal with that.
This seems like as good a place as any to start:
http://perldoc.perl.org/perlipc.html#Sockets%3a-Client%2fServer-Communication
> Thanks in advance
> Simo
Cheers,
Joost.
------------------------------
Date: Sat, 12 Jan 2008 18:56:53 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: Perl and C communication
Message-Id: <fmb2p5.11g.1@news.isolution.nl>
simone.romano82@gmail.com schreef:
> Is it this possible? there are a method for client e server to
> communicate??
perldoc perlipc
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Sat, 12 Jan 2008 18:51:28 GMT
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: Perl and C communication
Message-Id: <mm2io397qoatjf9s2djiubosanfikub6c1@4ax.com>
simone.romano82@gmail.com wrote:
>I have an important question: Perl and C can communicate ?
No. Those are programming languages and programming languages don't
communicate with each other (*).
(*): Well, there is embedded C, but that's probably not what you are talking
about.
>My problem is the following: I have Perl script (client) that could
>receive information ( via UDP connection) from a C program ( the
>server).
>Is it this possible? there are a method for client e server to
>communicate??
This on the other hand is no problem at all. Perl supports all the usual
methods of IPC (interprocess communication) and there are modules for pretty
much any client-server communication protocol available. Check out CPAN,
chances are very high that you will find a ready-made solution.
jue
------------------------------
Date: Fri, 11 Jan 2008 18:20:03 -0500
From: Steve <SteveSpamTrap@yahoo.com>
Subject: Retrieving autoincrement field from SQLite using DBI
Message-Id: <5uqbt4F1j3005U1@mid.individual.net>
When you use DBI to add a new record to a SQLite table, for which the
primary key column uses AUTOINCREMENT, is there a way to retrieve what
was the ID value generated for the record you just added?
------------------------------
Date: Fri, 11 Jan 2008 17:34:34 -0600
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: Retrieving autoincrement field from SQLite using DBI
Message-Id: <4787fd0a$0$503$815e3792@news.qwest.net>
Steve wrote:
> When you use DBI to add a new record to a SQLite table, for which
> the primary key column uses AUTOINCREMENT, is there a way to retrieve
> what was the ID value generated for the record you just added?
last_insert_id() didn't work?
------------------------------
Date: Sat, 12 Jan 2008 02:00:39 GMT
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: s/// does not affect pos?
Message-Id: <slrnfog7fq.r5n.tadmc@tadmc30.sbcglobal.net>
Florian Kaufmann <sensorflo@gmail.com> wrote:
> Simplified to the basics I have the following problem: I want to
> replace occurrences of double or single quoted strings in a text file.
> The following shows what I want to get.
>
> $ cat MyFile
> foo "D'Quote" bar 'S"Qu
> ote'
>
> $ MyScript < MyFile
> foo \begin{YasDQ}"D'Quote"\end{YasDQ} bar \begin{YasSQ}'S"Qu
> ote'\end{YasSQ}
my %q = ( q/"/ => 'YasDQ',
q/'/ => 'YasSQ'
);
s/(['"])(.*?)\1/\\begin{$q{$1}}$1$2$1\\end{$q{$1}}/gs;
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Sat, 12 Jan 2008 07:09:38 -0800 (PST)
From: "comp.llang.perl.moderated" <ced@blv-sam-01.ca.boeing.com>
Subject: Re: s/// does not affect pos?
Message-Id: <adbca990-9a93-45e4-8016-17bf486b2948@d70g2000hsb.googlegroups.com>
On Jan 11, 10:15 am, "comp.llang.perl.moderated" <c...@blv-
sam-01.ca.boeing.com> wrote:
> On Jan 11, 4:13 am, Florian Kaufmann <sensor...@gmail.com> wrote:
>
>
>
> > Simplified to the basics I have the following problem: I want to
> > replace occurrences of double or single quoted strings in a text file.
> > The following shows what I want to get.
>
> > $ cat MyFile
> > foo "D'Quote" bar 'S"Qu
> > ote'
>
> > $ MyScript < MyFile
> > foo \begin{YasDQ}"D'Quote"\end{YasDQ} bar \begin{YasSQ}'S"Qu
> > ote'\end{YasSQ}
>
> ...
>
> Here's a different approach via composition:
>
> my @SQ = ( qw/ \begin{YasSQ} \end{YasSQ} / );
> my @DQ = ( qw/ \begin{YasDQ} \end{YasDQ} / );
> my $str = "";
> while( m/\G(.*?)
> (["'])
> (.*?)
> \2
> /sxg ) {
>
> $str .= ( $2 eq "'" ? qq[$1$SQ[0]$2$3$2$SQ[1]]
> : qq[$1$DQ[0]$2$3$2$DQ[1]] );
>
> }
This 'solution' has problems... won't handle trailing characters after
the final quote-pair
for instance. See Tad's solution.
--
Charles DeRykus
------------------------------
Date: Sat, 12 Jan 2008 09:04:56 -0500
From: Bernie Cosell <bernie@fantasyfarm.com>
Subject: Simple "rm -rf"?
Message-Id: <r3iho3psrttro1d7vpdoup8ct9nrfoij4f@library.airnews.net>
I want to nuke a temp directory. The very simplest way to do it is
system("rm", "-rf", TEMPDIR), but I'm wondering if there's a perlish way to
do it that'd be about as easy. The only thing that comes to mind is a bit
of a mess, using File::Find and unlink'ing and rmdir'ing [as appropriate]
what you run into. Tnx...
/Bernie\
--
Bernie Cosell Fantasy Farm Fibers
bernie@fantasyfarm.com Pearisburg, VA
--> Too many people, too few sheep <--
------------------------------
Date: Sat, 12 Jan 2008 14:47:51 GMT
From: Peter Scott <Peter@PSDT.com>
Subject: Re: Simple "rm -rf"?
Message-Id: <pan.2008.01.12.14.47.50.626095@PSDT.com>
On Sat, 12 Jan 2008 09:04:56 -0500, Bernie Cosell wrote:
> I want to nuke a temp directory. The very simplest way to do it is
> system("rm", "-rf", TEMPDIR), but I'm wondering if there's a perlish way to
> do it that'd be about as easy. The only thing that comes to mind is a bit
> of a mess, using File::Find and unlink'ing and rmdir'ing [as appropriate]
> what you run into. Tnx...
If your program creates the directory to begin with, consider using
File::Temp:
$tempdir = tempdir( $template, CLEANUP => 1);
Create a temporary directory using the supplied template, but attempt
to remove it (and all files inside it) when the program exits. Note that
an attempt will be made to remove all files from the directory even if
they were not created by this module (otherwise why ask to clean it up?).
The directory removal is made with the rmtree() function from the
File::Path module.
--
Peter Scott
http://www.perlmedic.com/
http://www.perldebugged.com/
------------------------------
Date: 12 Jan 2008 17:43:59 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Simple "rm -rf"?
Message-Id: <slrnfohv2v.df.abigail@alexandra.abigail.be>
_
Bernie Cosell (bernie@fantasyfarm.com) wrote on VCCXLVII September
MCMXCIII in <URL:news:r3iho3psrttro1d7vpdoup8ct9nrfoij4f@library.airnews.net>:
?? I want to nuke a temp directory. The very simplest way to do it is
?? system("rm", "-rf", TEMPDIR), but I'm wondering if there's a perlish way to
?? do it that'd be about as easy. The only thing that comes to mind is a bit
?? of a mess, using File::Find and unlink'ing and rmdir'ing [as appropriate]
?? what you run into. Tnx...
Considering that Perl is a glue language, calling a tool to do the job
is a VERY Perlish way to accomplish your goals.
system rm => "-rf", TEMPDIR
takes just one line.
Abigail
--
perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
=>I=>$==-2449231+gm_julian_day+time);do{until($=<$#r){$_.=$r[$#r];$=-=$#r}for(;
!$r[--$#r];){}}while$=;$,="\x20";print+$_=>September=>MCMXCIII=>=>=>=>=>=>=>=>'
------------------------------
Date: Sat, 12 Jan 2008 19:42:29 +0100
From: Joachim Pense <snob@pense-mainz.eu>
Subject: Re: Simple "rm -rf"?
Message-Id: <19422vikq37r8.9xs9h0m83rqb.dlg@40tude.net>
Am 12 Jan 2008 17:43:59 GMT schrieb Abigail:
> _
> Bernie Cosell (bernie@fantasyfarm.com) wrote on VCCXLVII September
> MCMXCIII in <URL:news:r3iho3psrttro1d7vpdoup8ct9nrfoij4f@library.airnews.net>:
> ?? I want to nuke a temp directory. The very simplest way to do it is
> ?? system("rm", "-rf", TEMPDIR), but I'm wondering if there's a perlish way to
> ?? do it that'd be about as easy.
....
> Considering that Perl is a glue language, calling a tool to do the job
> is a VERY Perlish way to accomplish your goals.
>
> system rm => "-rf", TEMPDIR
>
> takes just one line.
>
And what if you need to port your code to Windows?
Joachim
------------------------------
Date: 12 Jan 2008 18:58:06 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Simple "rm -rf"?
Message-Id: <slrnfoi3du.df.abigail@alexandra.abigail.be>
_
Joachim Pense (snob@pense-mainz.eu) wrote on VCCXLVII September MCMXCIII
in <URL:news:19422vikq37r8.9xs9h0m83rqb.dlg@40tude.net>:
"" Am 12 Jan 2008 17:43:59 GMT schrieb Abigail:
""
"" > _
"" > Bernie Cosell (bernie@fantasyfarm.com) wrote on VCCXLVII September
"" > MCMXCIII in <URL:news:r3iho3psrttro1d7vpdoup8ct9nrfoij4f@library.airnews.net>:
"" > ?? I want to nuke a temp directory. The very simplest way to do it is
"" > ?? system("rm", "-rf", TEMPDIR), but I'm wondering if there's a perlish way to
"" > ?? do it that'd be about as easy.
"" ....
"" > Considering that Perl is a glue language, calling a tool to do the job
"" > is a VERY Perlish way to accomplish your goals.
"" >
"" > system rm => "-rf", TEMPDIR
"" >
"" > takes just one line.
"" >
""
"" And what if you need to port your code to Windows?
Considering that the OP said 'The very simplest way to do it is
system("rm", "-rf", TEMPDIR)', the OP either doesn't have a need to run
the script on Windows, or he has installed 'rm' on the Windows boxes he
needs to run the script on.
Abigail
--
map{${+chr}=chr}map{$_=>$_^ord$"}$=+$]..3*$=/2;
print "$J$u$s$t $a$n$o$t$h$e$r $P$e$r$l $H$a$c$k$e$r\n";
------------------------------
Date: 12 Jan 2008 18:58:55 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Simple "rm -rf"?
Message-Id: <Xns9A23840F66534castleamber@130.133.1.4>
Joachim Pense <snob@pense-mainz.eu> wrote:
> Am 12 Jan 2008 17:43:59 GMT schrieb Abigail:
>
>> _
>> Bernie Cosell (bernie@fantasyfarm.com) wrote on VCCXLVII September
>> MCMXCIII in
>> <URL:news:r3iho3psrttro1d7vpdoup8ct9nrfoij4f@library.airnews.net>:
>> ?? I want to nuke a temp directory. The very simplest way to do it
>> is ?? system("rm", "-rf", TEMPDIR), but I'm wondering if there's a
>> perlish way to ?? do it that'd be about as easy.
> ....
>> Considering that Perl is a glue language, calling a tool to do the
>> job is a VERY Perlish way to accomplish your goals.
>>
>> system rm => "-rf", TEMPDIR
>>
>> takes just one line.
>>
>
> And what if you need to port your code to Windows?
You install rm [1]
Anyway, did the OP suggest such a thing, or you just wanted to make up a
"problem" because you don't like the solution offered? (Just curious).
[1] http://gnuwin32.sourceforge.net/
or http://unxutils.sourceforge.net/
--
John
http://johnbokma.com/mexit/
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 1189
***************************************