[23707] in Perl-Users-Digest
Perl-Users Digest, Issue: 5913 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Dec 9 00:05:52 2003
Date: Mon, 8 Dec 2003 21: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)
Perl-Users Digest Mon, 8 Dec 2003 Volume: 10 Number: 5913
Today's topics:
Re: adobe multiline substitution <no_spam_for_jkeen@verizon.net>
Re: adobe multiline substitution <no_spam_for_jkeen@verizon.net>
Re: Am I right on Mod_Perl? <bigiain@mightymedia.com.au>
ANNOUNCE: Inline::Java 0.44 released (Patrick LeBoutillier)
Re: Another sort question. (Mal)
Re: Another sort question. <asu1@c-o-r-n-e-l-l.edu>
Re: can some one please explain this regex?! <geoff.cox@blueyonder.co.uk>
Can't resample with Lame (William)
Re: Getting return code from a child process <jgibson@mail.arc.nasa.gov>
Re: Help with formatting output with Text::Table <noreply@gunnar.cc>
Re: Help with formatting output with Text::Table (ko)
Perl script to process file list.... (Jim Carter)
Re: Perl script to process file list.... <asu1@c-o-r-n-e-l-l.edu>
Re: Perl script to process file list.... <invalid-email@rochester.rr.com>
Re: Perl script to process file list.... <tore@aursand.no>
Re: Perl script to process file list.... (Jay Tilton)
Re: Reading slective columns from *.csv file (Sara)
regular expression for perl, tcl, sed, grep, awk (Jay eL)
Re: regular expression for perl, tcl, sed, grep, awk <mgjv@tradingpost.com.au>
Re: regular expression for perl, tcl, sed, grep, awk <jwillmore@remove.adelphia.net>
Scp files to another server help (JennAshton)
Re: Scp files to another server help <asu1@c-o-r-n-e-l-l.edu>
Re: Validate Excel Range with RegEx (Jay Tilton)
What is the Best Content Management System? <test@test.com>
Re: What is the Best Content Management System? <computergeek714@hotmail.com>
Re: What is the Best Content Management System? <DSX@comcast.net>
Re: What is the Best Content Management System? <kain@despammed.com>
Re: What is the Best Content Management System? <tore@aursand.no>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 09 Dec 2003 00:17:38 GMT
From: "Jim Keenan" <no_spam_for_jkeen@verizon.net>
Subject: Re: adobe multiline substitution
Message-Id: <Cw8Bb.166$32.162@nwrdny03.gnilink.net>
"Justin" <justplain5fm@email.com> wrote in message
news:br2ms4$86i$1@news3.bu.edu...
> Hi,
>
> First off, I must apologise for cross posting.
Then why cross-post in the first place? One of the 3 groups to which you
posted (comp.lang.perl) has been deprecated for years. Another
(clp.modules) is appropriate if you have questions regarding use of a
particular Perl module. CGI questions are best handled on newsgroups
devoted to CGI.
Have you read the Posting Guidelines for this list? Please do so before
posting again. The guidelines will both tell you what to do *before*
posting (and in the process teach you a lot about figuring out Perl problems
yourself) and advise you on what constitutes a proper post (e.g., post
should include the Perl code that's giving you problems).
>
> I am having difficulty creating a pdf document using perl cgi to do
> substitution for multiline pdf form fields. I created a pdf template/file
> with substitution variables. The file is then read and variables
substituted
> using pattern matching. When I view the pdf multiline form field using
> acrobat, the field seems to be truncated. Upon view the properties of the
> multiline text field, I can see all the data in the field, but it still
> doesn't view correctly. I then view the properties, and just change/add a
> space using acrobat, the data then displays over multi lines.
> Does anyone have any ideas as to what I might be doing wrong.
>
If you "can see all the data in the field," I would infer that Perl is
picking up the data it's supposed to. This seems to be more of a problem in
Adobe Acrobat than in Perl.
jimk
------------------------------
Date: Tue, 09 Dec 2003 00:17:38 GMT
From: "Jim Keenan" <no_spam_for_jkeen@verizon.net>
Subject: Re: adobe multiline substitution
Message-Id: <Cw8Bb.167$32.99@nwrdny03.gnilink.net>
"Justin" <justplain5fm@email.com> wrote in message
news:br2ms4$86i$1@news3.bu.edu...
> Hi,
>
> First off, I must apologise for cross posting.
Then why cross-post in the first place? One of the 3 groups to which you
posted (comp.lang.perl) has been deprecated for years. Another
(clp.modules) is appropriate if you have questions regarding use of a
particular Perl module. CGI questions are best handled on newsgroups
devoted to CGI.
Have you read the Posting Guidelines for this list? Please do so before
posting again. The guidelines will both tell you what to do *before*
posting (and in the process teach you a lot about figuring out Perl problems
yourself) and advise you on what constitutes a proper post (e.g., post
should include the Perl code that's giving you problems).
>
> I am having difficulty creating a pdf document using perl cgi to do
> substitution for multiline pdf form fields. I created a pdf template/file
> with substitution variables. The file is then read and variables
substituted
> using pattern matching. When I view the pdf multiline form field using
> acrobat, the field seems to be truncated. Upon view the properties of the
> multiline text field, I can see all the data in the field, but it still
> doesn't view correctly. I then view the properties, and just change/add a
> space using acrobat, the data then displays over multi lines.
> Does anyone have any ideas as to what I might be doing wrong.
>
If you "can see all the data in the field," I would infer that Perl is
picking up the data it's supposed to. This seems to be more of a problem in
Adobe Acrobat than in Perl.
jimk
------------------------------
Date: Tue, 09 Dec 2003 13:48:37 +1100
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: Am I right on Mod_Perl?
Message-Id: <bigiain-BDCB02.13483709122003@news.fu-berlin.de>
In article <slrnbt9mka.q4f.tadmc@magna.augustmail.com>,
tadmc@augustmail.com (Tad McClellan) wrote:
> David K. Wall <usenet@dwall.fastmail.fm> wrote:
> > Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> wrote:
> >> Randal L. Schwartz <merlyn@stonehenge.com> wrote in
> >> comp.lang.perl.misc:
> >>> >>>>> "Picker" == Picker Leon <Temp@NoSuchDomain.Info> writes:
> >>>
> >>> Picker> Please correct me if I am wrong.
> >>>
> >>> Asking for that is implied. :) You're in CLPM, remember? :)
> >>
> >> s/CLPM/Usenet/
> >
> > "the best way to get accurate information on Usenet is to post
> > something wrong and wait for corrections"
>
>
> Pigs can fly!
Correct, as per the RFC:
"With sufficient thrust ,pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead." -- RFC 1925
:-)
big
--
'When I first met Katho, she had a meat cleaver in one hand and
half a sheep in the other. "Come in", she says, "Hammo's not here.
I hope you like meat.' Sharkey in aus.moto
------------------------------
Date: Tue, 9 Dec 2003 01:04:18 GMT
From: patrick_leboutillier@hotmail.com (Patrick LeBoutillier)
Subject: ANNOUNCE: Inline::Java 0.44 released
Message-Id: <HpM1E5.13r2@zorch.sf-bay.org>
Hi all,
I've just uploaded it to CPAN.
======================================================================
INTRODUCTION:
Inline::Java - Write Perl classes in Java.
Inline::Java lets you write Perl classes in Java.
Example:
use Inline Java => <<'END';
class JAxH {
public JAxH(String x){
System.out.println("Just Another " + x + " Hacker") ;
}
}
END
new JAxH('Inline') ;
When run, this complete program prints:
Just Another Inline Hacker
-------------------------------------------------------------------------------
JNI (JAVA NATIVE INTERFACE) EXTENSION:
Inline::Java now provides a JNI extension that allows you to load the Java
virtual machine as shared object instead of running it as a separate process.
See README.JNI for more information on building the JNI extension.
-------------------------------------------------------------------------------
INSTALLATION:
- This module requires Inline version 0.44 or higher to be installed.
- It also requires a version of the Java SDK 1.2 or higher to be
installed. You can get the latest Java SDK from Sun Microsystems
at http://java.sun.com. Follow the provided instructions in order
to install the Java SDK properly.
To install Inline::Java do this:
% perl Makefile.PL J2SDK=/your/java/dir (see Note 1)
% make java (see Note 2)
% make
% make test (see Note 3, 4)
% make install
You have to 'make install' before you can run it successfully.
Note 1: Under Win95/98/Me, you may need to do 'cd ..' to get back to the
your original directory after the command has completed.
Note 2: Use nmake on Win32.
Note 3: If you have built the JNI extension and want the test suite to use
it, you will need to set the PERL_INLINE_JAVA_JNI environment variable to 1
BEFORE running 'make test'.
Note 4: When testing Inline::Java, it's always a good idea to run 'make test'
twice. The first time you test the building and loading of a module, the
second time you test loading of an already built module.
-------------------------------------------------------------------------------
FEATURES:
Inline::Java version 0.44 is a major upgrade that includes:
+ Callbacks from multiple threads are now supported (think SWING)
+ Refactored (again...) studying/.jdat/cache stuff
+ Added PRIVATE mode for use with SHARED_JVM
+ Added DEBUGGER mode that launches jdb
+ Fixed memory leak in JNI code (patch submitted by Dave Blob)
-------------------------------------------------------------------------------
INFORMATION:
= For more information on Inline::Java, see 'perldoc Inline::Java'.
= For information about Inline, see 'perldoc Inline'.
= For information on using Java, visit http://java.sun.org.
Inline::Java's mailing list is inline@perl.org.
To subscribe, send an email to inline-subscribe@perl.org.
Inline::Java's home page is http://inline.perl.org/java/.
Please send questions and comments to Patrick LeBoutillier <patl@cpan.org>.
Copyright (c) 2001-2003, Patrick LeBoutillier. All Rights Reserved.
------------------------------
Date: 8 Dec 2003 15:10:39 -0800
From: mpatt644@yahoo.com (Mal)
Subject: Re: Another sort question.
Message-Id: <66f79aeb.0312081510.8a12e64@posting.google.com>
I figured out that replacing
$aHourField <=> $bHourField
with
(($aHourField+17) %24) <=> (($bHourField+17) %24)
does what I need.
>
> use strict;
> #
> # Create some test data
> #
> open(testout,">test.dat");
> print testout "Enabled blah,blah,blah 18:30\n";
> print testout "Enabled blah,blah,blah 23:30\n";
> print testout "Disabled blah,blah,blah 18:00\n";
> print testout "Enabled blah,blah,blah 3:50\n";
> print testout "Enabled blah,blah,blah 20:50\n";
> print testout "Disabled blah,blah,blah 19:30\n";
> print testout "Enabled blah,blah,blah 23:40\n";
> print testout "Enabled blah,blah,blah 1:30\n";
> close(testout);
>
> open(test,"test.dat");
> chomp (my @results=<test>);
> foreach (sort {
> my $aEnabledField=substr($a,0,20);
> my $bEnabledField=substr($b,0,20);
> (my $aHourField,my $aMinField)=split
> /:/,substr($a,38,20);
> (my $bHourField,my $bMinField)=split
> /:/,substr($b,38,20);
> $aEnabledField cmp $bEnabledField
> ||
> $aHourField <=> $bHourField
> ||
> $aMinField <=> $bMinField
> } @results) {
> print "$_\n";
> }
------------------------------
Date: 9 Dec 2003 01:48:26 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Another sort question.
Message-Id: <Xns944BD3AA892F4asu1cornelledu@132.236.56.8>
mpatt644@yahoo.com (Mal) wrote in news:66f79aeb.0312081510.8a12e64
@posting.google.com:
> I figured out that replacing
>
> $aHourField <=> $bHourField with
> (($aHourField+17) %24) <=> (($bHourField+17) %24)
>
> does what I need.
Could you explain that please?
suppose
$aHourField = 7
$bHourField = 18
then
$aHourField + 17 = 24
$bHourField + 17 = 35
and
24 % 24 = 0
35 % 24 = 11
How did that change the comparison at all?
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Mon, 08 Dec 2003 20:22:52 +0000
From: Geoff Cox <geoff.cox@blueyonder.co.uk>
Subject: Re: can some one please explain this regex?!
Message-Id: <fbn9tv0snj5balu8jqkj7uoj5rj01l7bq1@4ax.com>
On Mon, 8 Dec 2003 22:28:36 +1300, "Tintin" <me@privacy.net> wrote:
>
>"Geoff Cox" <geoff.cox@blueyonder.co.uk> wrote in message
>news:dkc8tvcm8v7l0g01pe28cei29rj61b1tqb@4ax.com...
>> On Sun, 7 Dec 2003 17:59:08 -0600, tadmc@augustmail.com (Tad
>> McClellan) wrote:
>>
>> >Geoff Cox <geoff.cox@blueyonder.co.uk> wrote:
>> >
>> >> open(DATA, "$namehtml");
>> > ^ ^
>> >
>> > perldoc -q vars
>> >
>> > What's wrong with always quoting "$vars"?
I assuem you mean simply that there is no need to have the quotes
round $vars if it is on its own?
Geoff
>>
>> Tad, not sure what you mean above?
>
>Have you read what it says? Is there something you don't understand in the
>documentation?
>
------------------------------
Date: 8 Dec 2003 19:02:24 -0800
From: wgannon@beacon.com (William)
Subject: Can't resample with Lame
Message-Id: <8059d067.0312081902.1347897@posting.google.com>
I am running Apache 1.3.29, ActiveState Perl 5.6, Windows XP and
mod_perl. Here is part of my httpd.conf file for configuring the
handler for the /Songs location.
<Location /Songs>
SetHandler perl-script
PerlSetEnv PATH c:/lame
PerlHandler Apache::MP3::Resample
PerlSetVar CacheDir /temp
PerlSetVar MP3Encoder 'lame --mp3input %b - <%f'
PerlSetVar ResamplePresets 'Low => -b16'
PerlSetVar AllowDownload no
</Location>
I set up a simple html file with the following:
<a href="/Songs/Song_to_play.m3u?play=1>Song</a> where
Song_to_play.mp3 is located in the /Songs directory.
When I click on the link, the Apache::MP3 module streams the file in
it's original bitrate, but I want it to stream in the Low bitrate
(defined above). I'm not sure why this isn't working, but any help
will be greatly appreciated.
------------------------------
Date: Mon, 08 Dec 2003 16:46:03 -0800
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Getting return code from a child process
Message-Id: <081220031646033283%jgibson@mail.arc.nasa.gov>
In article <bqqlnp$mpn$1@wisteria.csv.warwick.ac.uk>, Ben Morrow
<usenet@morrow.me.uk> wrote:
[question from Jon about getting return code from child process snipped]
>
> > I *think* there might be a way to do this with pipes, but
> > I have no clue as to how to do that.
>
> 2. Pass the data back from child to parent in a pipe. You need to
> decide on some format for your data: if there are no other
> considerations, Storable provides a compact representation of
> 'most any Perl data structure. The way you would do this would be
> something like (this is completely untested and written straight
> off the top of my head):
>
> use Storable qw/store_fd fd_retrieve/;
>
> my $kid = fork;
> defined $kid or die "fork failed: $!";
>
> pipe my $FROM, my $TO;
>
> if($kid) {
> close $TO;
> # parent
> } else {
> close $FROM;
> my $return = my_function();
> store_fd \$return, $TO; # you have to store a reference
> exit 0;
> }
>
> my $return = fd_retrieve $FROM or die "fd_retrieve: $!";
> $return = $$return; # de-ref the reference
> close $FROM;
>
While I am loathe to question the answers of others, shouldn't one
create the pipe _before_ doing the fork so that both parent and child
process are using the same anonymous pipe?
------------------------------
Date: Tue, 09 Dec 2003 00:08:01 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Help with formatting output with Text::Table
Message-Id: <br30ol$257vkv$1@ID-184292.news.uni-berlin.de>
Mothra wrote:
> I need some help formatting text output using Text table. Is there
> a way to increase the space between the columns? The output from
> what I have is:
>
> Date Sunset Time
> 12/01/2003 16:42:32
> 12/01/2003 16:42:40
> 12/02/2003 16:42:32
>
> What I would like is:
>
> Date Sunset Time
> 12/01/2003 16:42:32
> 12/01/2003 16:42:40
> 12/02/2003 16:42:32
How about doing as the documentation for Text::Table suggests? ;-)
my $tb = Text::Table->new(
{ title => 'Date', align_title => 'center' },
{ is_sep => 1, title => ' ' },
{ title => 'Sunset Time', align_title => 'center' }
);
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: 8 Dec 2003 17:15:38 -0800
From: kuujinbo@hotmail.com (ko)
Subject: Re: Help with formatting output with Text::Table
Message-Id: <92d64088.0312081715.1a9c08a0@posting.google.com>
"Mothra" <mothra@nowhereatall.com> wrote in message news:<3fd48d94@usenet.ugs.com>...
> Hi All,
>
> I need some help formatting text output using Text table.
> Is there a way to increase the space between the columns?
> The output from what I have is:
>
> Date Sunset Time
> 12/01/2003 16:42:32
> 12/01/2003 16:42:40
> 12/02/2003 16:42:32
>
> What I would like is:
>
> Date Sunset Time
> 12/01/2003 16:42:32
> 12/01/2003 16:42:40
> 12/02/2003 16:42:32
>
> (I hope the newsreader does not screw this up)
> I need to increase the space between the columns.
> Also, Is there a way to add an overall title?
> like:
> Covenant Christian School location
> Date Sunset Time
> 12/01/2003 16:42:32
> 12/01/2003 16:42:40
> 12/02/2003 16:42:32
> Have the main title ( Coventant Christian school location) the
> main center then Date (centered) Sunset Time (centered).
>
> I hope this makes sense.
> Thanks
>
> Mothra
[snip code]
There probably is a better way to do this, since the following code
uses two tables to align the 'overall title':
#!/usr/bin/perl -w
use strict;
use Text::Table;
my @data = map [ split ], <DATA>;
my $t1 = Text::Table->new(
{ title => 'Date', align => 'center', align_title => 'center' },
{ is_sep => 1, title => ' ' x 4 }, # change '4' to your needs
{ title => 'Sunset Time', align => 'center',
align_title => 'center' },
);
$t1->load( @data );
my $t2 = Text::Table->new(
{ title => 'Covenant Christian School location',
align => 'center', align_title => 'center',
}
);
$t2->load( map { chomp; [$_] } $t1->table );
print $t2;
__DATA__
12/01/2003 16:42:32
12/01/2003 16:42:40
12/02/2003 16:42:32
HTH - keith
------------------------------
Date: 8 Dec 2003 17:36:07 -0800
From: carterave@yahoo.com (Jim Carter)
Subject: Perl script to process file list....
Message-Id: <9c2a26b6.0312081736.593a8686@posting.google.com>
Hi all,
Below is the issue I am working on in Windows 2000.
I have directory, C:\Carter and it it has around 100 file names (ex:
test1.txt, test2.txt, test3.txt......test100.txt).
1. First, I need another list with all these 100 file names with no
".txt" extension at the end (ex: test1, test2,test3, ....test100).
2. Then I want these two lists as key and value pair in a hash.
(EX: test1, test1.txt, test2, test2.txt, test3, test3.txt, ......,
test100, test100.txt).
I am struggling with the code to get the final hash. Can some one help
me out?
Thanks,
Carter
------------------------------
Date: 9 Dec 2003 02:12:21 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Perl script to process file list....
Message-Id: <Xns944BD7B8AD1F4asu1cornelledu@132.236.56.8>
carterave@yahoo.com (Jim Carter) wrote in
news:9c2a26b6.0312081736.593a8686@posting.google.com:
> Hi all,
>
> Below is the issue I am working on in Windows 2000.
>
> I have directory, C:\Carter and it it has around 100 file names (ex:
> test1.txt, test2.txt, test3.txt......test100.txt).
>
> 1. First, I need another list with all these 100 file names with no
> ".txt" extension at the end (ex: test1, test2,test3, ....test100).
> 2. Then I want these two lists as key and value pair in a hash.
> (EX: test1, test1.txt, test2, test2.txt, test3, test3.txt, ......,
> test100, test100.txt).
>
> I am struggling with the code to get the final hash. Can some one help
> me out?
At least in this forum, you are expected to show your attempt at solving
the problem. Please remember that in the future and do consult the
posting quidelines.
C:\carter> dir
2003/12/08 09:10 PM <DIR> .
2003/12/08 09:10 PM <DIR> ..
2003/12/08 08:56 PM 0 01 (1).txt
2003/12/08 08:56 PM 0 01 (10).txt
2003/12/08 08:56 PM 0 01 (11).txt
2003/12/08 08:56 PM 0 01 (12).txt
2003/12/08 08:56 PM 0 01 (13).txt
2003/12/08 08:56 PM 0 01 (2).txt
2003/12/08 08:56 PM 0 01 (3).txt
2003/12/08 08:56 PM 0 01 (4).txt
2003/12/08 08:56 PM 0 01 (5).txt
2003/12/08 08:56 PM 0 01 (6).txt
2003/12/08 08:56 PM 0 01 (7).txt
2003/12/08 08:56 PM 0 01 (8).txt
2003/12/08 08:56 PM 0 01 (9).txt
2003/12/08 08:56 PM 0 01.txt
2003/12/08 09:10 PM 295 zbzbz.pl
C:\carter> cat zbzbz.pl
use strict;
use warnings;
my %hash;
opendir DIR, 'C:/Carter' or die "Cannot open C:/Carter: $!\n";
ENTRY: while(my $entry = readdir(DIR)) {
next ENTRY if($entry !~ m/^(.+)\.txt$/o);
$hash{$1} = $entry;
}
closedir DIR;
use Data::Dumper;
print Dumper \%hash;
C:\carter> zbzbz.pl
$VAR1 = {
'01 (4)' => '01 (4).txt',
'01' => '01.txt',
'01 (2)' => '01 (2).txt',
'01 (10)' => '01 (10).txt',
'01 (8)' => '01 (8).txt',
'01 (12)' => '01 (12).txt',
'01 (13)' => '01 (13).txt',
'01 (7)' => '01 (7).txt',
'01 (6)' => '01 (6).txt',
'01 (3)' => '01 (3).txt',
'01 (1)' => '01 (1).txt',
'01 (11)' => '01 (11).txt',
'01 (9)' => '01 (9).txt',
'01 (5)' => '01 (5).txt'
};
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Tue, 09 Dec 2003 02:17:43 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Perl script to process file list....
Message-Id: <3FD52CC8.6040408@rochester.rr.com>
Jim Carter wrote:
...
> Below is the issue I am working on in Windows 2000.
>
> I have directory, C:\Carter and it it has around 100 file names (ex:
> test1.txt, test2.txt, test3.txt......test100.txt).
>
> 1. First, I need another list with all these 100 file names with no
> ".txt" extension at the end (ex: test1, test2,test3, ....test100).
> 2. Then I want these two lists as key and value pair in a hash.
> (EX: test1, test1.txt, test2, test2.txt, test3, test3.txt, ......,
> test100, test100.txt).
>
> I am struggling with the code to get the final hash. Can some one help
> me out?
Um, it is pretty hard to help you with code we can't see. Post by
copy/pasting code (as opposed to retying) a complete example of your
code which anyone can copy/paste/execute which demonstrates the problem
you are having, and clearly (*not* "it doesn't work") state what you
perceive to wrong, including verbatim copies of error messages, and
folks here will gladly help you.
> Carter
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Tue, 09 Dec 2003 05:22:01 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: Perl script to process file list....
Message-Id: <pan.2003.12.09.04.10.51.335131@aursand.no>
On Mon, 08 Dec 2003 17:36:07 -0800, Jim Carter wrote:
> I have directory, C:\Carter and it it has around 100 file names (ex:
> test1.txt, test2.txt, test3.txt......test100.txt).
>
> 1. First, I need another list with all these 100 file names with no
> ".txt" extension at the end (ex: test1, test2,test3, ....test100).
## Get a list of all *.txt files
opendir( DIR, 'C:\Carter' ) or die "$!\n";
my @files = grep { /\.txt$/ } readdir( DIR );
closedir( DIR );
## Create a list of those files without the extension and put them
## in a hash pointing to their original filename
use File::Basename qw( fileparse );
my %hash = ();
foreach ( @files ) {
my ($filename, undef, undef) = fileparse( $_ );
$hash{ $filename } = $_;
}
--
Tore Aursand <tore@aursand.no>
"Scientists are complaining that the new "Dinosaur" movie shows
dinosaurs with lemurs, who didn't evolve for another million years.
They're afraid the movie will give kids a mistaken impression. What
about the fact that the dinosaurs are singing and dancing?" -- Jay
Leno
------------------------------
Date: Tue, 09 Dec 2003 04:33:19 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Perl script to process file list....
Message-Id: <3fd54ee5.171951178@news.erols.com>
carterave@yahoo.com (Jim Carter) wrote:
: Below is the issue I am working on in Windows 2000.
:
: I have directory, C:\Carter and it it has around 100 file names (ex:
: test1.txt, test2.txt, test3.txt......test100.txt).
:
: 1. First, I need another list with all these 100 file names with no
: ".txt" extension at the end (ex: test1, test2,test3, ....test100).
: 2. Then I want these two lists as key and value pair in a hash.
: (EX: test1, test1.txt, test2, test2.txt, test3, test3.txt, ......,
: test100, test100.txt).
:
: I am struggling with the code to get the final hash. Can some one help
: me out?
use File::Slurp 'read_dir';
my %hash = reverse map /^((.+)\.txt)$/, read_dir('C:/Carter');
------------------------------
Date: 8 Dec 2003 16:50:16 -0800
From: genericax@hotmail.com (Sara)
Subject: Re: Reading slective columns from *.csv file
Message-Id: <776e0325.0312081650.735cc962@posting.google.com>
survesh2000@yahoo.com (Nithin) wrote in message news:<55b7ea65.0312081059.1f8b6a2@posting.google.com>...
> Hi,
> I have a *.csv file that looks like this. I need to ignore Rows 1-5
> and start reading from Row 6. From Row 6 I need only Column1, Column
> 3, Column4 and so on....(has about 35 values in each row).
>
>
> RED - Letters in Red auto-populate columns from left to right.
> Color Code - Yellow Field name boxes in yellow are fields required
> Color Code - Gray Field name boxes in gray are fields are optional
> Color Code - Green Field name boxes in green are optional fields
> Color Code - Orange Field name boxes in orange indicate d - refer etc
> 44383 Ontario Dork Canal 288 1398 Malheur Ave TAC31NT
> 44384 Ontario Dork Canal 288 1398 Malheur Ave TAC31NT
> 44385 Ontario Dork Canal 288 1398 Malheur Ave TAC31NT
>
>
> Previously, I used to copy manually the values I wanted to the
> input.csv file. But, now I want to read directly from the source file
> and avoid the extra step.
>
> My code looks like this
>
> open FILE, "input.csv";
>
> while (<FILE>) {
> chomp;
> my ($col1, $col2, $col3, $col4, $col6) = split (/\,/);
> }
a few comments:
1.) For a csv there seems to be a small number of commas. A csv file
should have a number of commas c where c > 0.
2.) No matter what language you're using, if you see something like
($col1, $col2, $col3, $col4, $col6)
this should STRONGLY suggest to you an ARRAY data structure. Much
better to use
my @cols = split /,/;
3.) If you can get the file into an array of lines, its useful for
debugging and other purposes as well. Its also best to use guerilla
tacxtics with files- get in, grab what you need, get out. Not
practical for all file sizes however.
use strict; # never leave home without it!
die "file cannot be opened for some odd reason: $!\n" unlesss open F,
"input.csv"; # do a little error checking
my @lines = <F>;
close F;
die "strange, nothing here!\n" unless @lines; # another error check
my @cols;
for (@lines)
{chomp; # you may not really need to chomp
# note only 1 arg since $_ is the default- clean syntax,
# also no need to \ the , it wont get misinterpreted in this context
@cols = split /,/;
.
.
.
you take it from here..
}
G
------------------------------
Date: 8 Dec 2003 17:59:53 -0800
From: xiaohwarang@yahoo.co.uk (Jay eL)
Subject: regular expression for perl, tcl, sed, grep, awk
Message-Id: <9079c005.0312081759.2009d84a@posting.google.com>
Hi all,
I wonder is the regular expression the same for perl, tcl, sed, grep
and awk except for the syntax? all the usage for . * ? + / () [] are
the same?
Thanks in advance
------------------------------
Date: 09 Dec 2003 02:59:48 GMT
From: Martien Verbruggen <mgjv@tradingpost.com.au>
Subject: Re: regular expression for perl, tcl, sed, grep, awk
Message-Id: <slrnbtael6.hsp.mgjv@verbruggen.comdyn.com.au>
On 8 Dec 2003 17:59:53 -0800,
Jay eL <xiaohwarang@yahoo.co.uk> wrote:
> Hi all,
>
> I wonder is the regular expression the same for perl, tcl, sed, grep
> and awk except for the syntax?
It's a bit of an odd question. What do you mean "the same" "except for
the syntax"? The syntax is different in many cases, and the features
are also different for many of them. It also depends on your platform
which sorts of RE are supported by your sed, grep and awk. There are
minimal sets defined by standards, but that doesn't mean that your
local ones don't support more.
Generally: unless the software specifically mentions that it supports
Perl's RE, it won't. Perl's RE engine is pretty much the most powerful
out there (pcre is a library making Perl RE available to other
programs).
Some tools support more than one RE syntax, depending on invocation
and arguments.
I don't know which RE tcl supports nowadays. I haven't touched it in
about 8 years.
> all the usage for . * ? + / () [] are
> the same?
The slash is not a special character in regular expressions, but it's
most often used as the delimiter for the operators that take regular
expressions in tools that do.
The others should all pretty much act the same, although in some RE
engines you actually need to escape some of them to make them special.
You'll have to read the documentation of the tool or language you're
interested in to find out more.
Why did you ask this question in a Perl group? Or did you post it
independently to a bunch of other groups as well?
Martien
--
|
Martien Verbruggen | You can't have everything, where would you
Trading Post Australia | put it?
|
------------------------------
Date: Tue, 09 Dec 2003 04:23:35 GMT
From: James Willmore <jwillmore@remove.adelphia.net>
Subject: Re: regular expression for perl, tcl, sed, grep, awk
Message-Id: <20031208232333.4800e13f.jwillmore@remove.adelphia.net>
On 8 Dec 2003 17:59:53 -0800
xiaohwarang@yahoo.co.uk (Jay eL) wrote:
> Hi all,
>
> I wonder is the regular expression the same for perl, tcl, sed, grep
> and awk except for the syntax? all the usage for . * ? + / () []
> are the same?
perldoc perlre
This will give information on regular expressions usage in Perl. I'm
thinking other languages have documentation as well.
O'Reilly has a book .... "Mastering Regular Expressions". Maybe this
would aid in whatever comparison you're making. I don't know off hand
if there are any resources on the 'Net for this - but if you use
Google, you might get some hits.
HTH
--
Jim
Copyright notice: all code written by the author in this post is
released under the GPL. http://www.gnu.org/licenses/gpl.txt
for more information.
a fortune quote ...
Hark, Hark, the dogs do bark The Duke is fond of kittens He likes
to take their insides out And use them for his mittens From "The
Thirteen Clocks"
------------------------------
Date: 8 Dec 2003 18:05:19 -0800
From: joel@tradersunited.com (JennAshton)
Subject: Scp files to another server help
Message-Id: <c5b9b407.0312081805.19193fd1@posting.google.com>
Hi,
I wrote a simple scp script from my server to pacman server which
copies all jpg files to /jennash/ directory.
Now, I need help with this script. I would like it to pull not just
*.jpg files but other file types as well. Also, is it possible to pull
only files that is 3 minutes old? Please help.
Thanks!
JennAsh
#!/usr/bin/perl
system('scp /export/www/docs/*.jpg pacman:/export/www/jennash/');
exit;
------------------------------
Date: 9 Dec 2003 02:25:19 GMT
From: "A. Sinan Unur" <asu1@c-o-r-n-e-l-l.edu>
Subject: Re: Scp files to another server help
Message-Id: <Xns944BD9EB9FB08asu1cornelledu@132.236.56.8>
joel@tradersunited.com (JennAshton) wrote in
news:c5b9b407.0312081805.19193fd1@posting.google.com:
> Hi,
>
> I wrote a simple scp script from my server to pacman server which
> copies all jpg files to /jennash/ directory.
...
> #!/usr/bin/perl
>
> system('scp /export/www/docs/*.jpg pacman:/export/www/jennash/');
>
> exit;
Well, this is a Perl script in a very loose sense of the word.
> Now, I need help with this script. I would like it to pull not just
> *.jpg files but other file types as well.
Definitely doable .. just change the extension.
> Also, is it possible to pull only files that is 3 minutes old?
perldoc -f stat
Please help.
--
A. Sinan Unur
asu1@c-o-r-n-e-l-l.edu
Remove dashes for address
Spam bait: mailto:uce@ftc.gov
------------------------------
Date: Mon, 08 Dec 2003 23:13:20 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Validate Excel Range with RegEx
Message-Id: <3fd5056d.153140681@news.erols.com>
fletch@hudsonroad.freeserve.co.uk (Fletch) wrote:
: Any thoughts on how to validate an Excel range with RegEx?
: Acceptable inputs would include $A1:$BD25, C:C, B4 etc.
: I'm close to coming up with an answer but I'm not sure how to stop
: invalid range references such as C3:A2 from being accepted.
What makes "C3:A2" an invalid range specification? Excel accepts it
without any complaint.
A set of row/column adresses is not the only way to specify a range.
Range("foo") is perfectly acceptable syntax for referring to a named range.
Validating the argument with a regex is fine if you want to impose
arbitrary restrictions on its format. You first need to decide exactly
what formats are valid, which means "etc." is right out.
If you simply want to catch arguments that will make Excel puke, you're
better off not wanting that. Just use the argument as it is and trap
errors thrown by Excel.
------------------------------
Date: Mon, 08 Dec 2003 23:27:26 GMT
From: "Liberal" <test@test.com>
Subject: What is the Best Content Management System?
Message-Id: <yN7Bb.168688$Ec1.6477100@bgtnsc05-news.ops.worldnet.att.net>
There are a few in Perl and PHP, with MySQL or without and either in
Mod_Perl or not in.
I have heard mason, but it does not have any demo site, but claims, AMAZON
is using it.
I also like PostNuke, but then there is a sister product caled PHPNuke
I am looking for something simple but with a lot of plug-ins. I will not use
many features, but like to have BBS/Forum and Classified Ads. I want it
simple, because I need to rewrite a lot of codes to include my current Perl
program.
What is my best choice?
------------------------------
Date: Mon, 08 Dec 2003 15:03:28 -0900
From: CompGeek <computergeek714@hotmail.com>
Subject: Re: What is the Best Content Management System?
Message-Id: <3fd51299@news.arctic.net>
Liberal wrote:
> There are a few in Perl and PHP, with MySQL or without and either in
> Mod_Perl or not in.
>
> I have heard mason, but it does not have any demo site, but claims, AMAZON
> is using it.
>
> I also like PostNuke, but then there is a sister product caled PHPNuke
>
> I am looking for something simple but with a lot of plug-ins. I will not use
> many features, but like to have BBS/Forum and Classified Ads. I want it
> simple, because I need to rewrite a lot of codes to include my current Perl
> program.
>
> What is my best choice?
>
>
I use CuteNews... Really professional, looks nice, and customizable....
Check it out @ http://www.cutephp.com/
CompGeek
------------------------------
Date: Tue, 09 Dec 2003 00:50:40 GMT
From: "Nick Santos" <DSX@comcast.net>
Subject: Re: What is the Best Content Management System?
Message-Id: <A%8Bb.274761$Dw6.937101@attbi_s02>
"Liberal" <test@test.com> wrote in message
news:yN7Bb.168688$Ec1.6477100@bgtnsc05-news.ops.worldnet.att.net...
> There are a few in Perl and PHP, with MySQL or without and either in
> Mod_Perl or not in.
>
> I have heard mason, but it does not have any demo site, but claims, AMAZON
> is using it.
>
> I also like PostNuke, but then there is a sister product caled PHPNuke
>
> I am looking for something simple but with a lot of plug-ins. I will not
use
> many features, but like to have BBS/Forum and Classified Ads. I want it
> simple, because I need to rewrite a lot of codes to include my current
Perl
> program.
>
> What is my best choice?
>
Well, if you want to include a current program, PHPNuke only requires you to
make a directory with the program, and the program can handle itself from
there. You will only need to cdo a few things under the Administration panel
to get it to work . It also has forums...dunno about classified ads though.
PHPNuke is decent, but you can usually ID when a site is using it because
they tend to look fairly similar. There may be better systems on the web,
but if you just want it to link to include your program(unless you want it
embedded in the main page or anything) it's pretty good about that.
------------------------------
Date: Tue, 09 Dec 2003 01:05:50 GMT
From: "kain" <kain@despammed.com>
Subject: Re: What is the Best Content Management System?
Message-Id: <Od9Bb.67423$AX1.2850045@news1.tin.it>
"Liberal" <test@test.com> ha scritto nel messaggio
news:yN7Bb.168688$Ec1.6477100@bgtnsc05-news.ops.worldnet.att.net...
> There are a few in Perl and PHP, with MySQL or without and either in
> Mod_Perl or not in.
>
> I have heard mason, but it does not have any demo site, but claims, AMAZON
> is using it.
>
> I also like PostNuke, but then there is a sister product caled PHPNuke
>
> I am looking for something simple but with a lot of plug-ins. I will not
use
> many features, but like to have BBS/Forum and Classified Ads. I want it
> simple, because I need to rewrite a lot of codes to include my current
Perl
> program.
>
> What is my best choice?
>
e-xoops
------------------------------
Date: Tue, 09 Dec 2003 05:22:02 +0100
From: Tore Aursand <tore@aursand.no>
Subject: Re: What is the Best Content Management System?
Message-Id: <pan.2003.12.09.04.04.47.292424@aursand.no>
On Mon, 08 Dec 2003 23:27:26 +0000, Liberal wrote:
> There are a few in Perl and PHP, with MySQL or without and either in
> Mod_Perl or not in.
Take a look at Bricolage. It's in Perl and uses PostgreSQL to store its
data. It's free and open source, of course;
<http://www.bricolage.cc/>
> I have heard mason, but it does not have any demo site, but claims, AMAZON
> is using it.
HTML::Mason is _not_ a CMS. You can check Mason's homepage for links to
sites that are running HTML::Mason;
<http://www.masonhq.com/>
> What is my best choice?
You'll have to figure out yourself, I guess. There have been mentioned a
few already, and I can add this one:
<http://www.drupal.org/>
Never used it, though, but it looks slick.
--
Tore Aursand <tore@aursand.no>
"I know not with what weapons World War 3 will be fought, but World War
4 will be fought with sticks and stones." -- Albert Einstein
------------------------------
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 5913
***************************************