[28409] in Perl-Users-Digest
Perl-Users Digest, Issue: 9773 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 27 03:05:48 2006
Date: Wed, 27 Sep 2006 00:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 27 Sep 2006 Volume: 10 Number: 9773
Today's topics:
Computer Language Popularity Trend <xah@xahlee.org>
Re: Computer Language Popularity Trend <dh.evolutionnext@gmail.com>
Re: Endless loop in Text::Format::reformat() <nobull67@gmail.com>
Re: Ftp via Perl cron job <bill@ts1000.us>
Need help with pattern matching/substitution. <shah@typhoon.xnet.com>
Re: Need help with pattern matching/substitution. <abigail@abigail.be>
Re: Net::LDAP help.... <user@example.invalid>
new CPAN modules on Wed Sep 27 2006 (Randal Schwartz)
Re: pod - purpose of L<> directive <bol@adv.magwien.gv.at>
question about $list[1] x @list2 <JialinLi1981@gmail.com>
Re: question about $list[1] x @list2 <JialinLi1981@gmail.com>
Re: Reading from standard input <harpreet.saluja@gmail.com>
Re: remove last 10 lines of all files in a directory <kkeller-usenet@wombat.san-francisco.ca.us>
Re: remove last 10 lines of all files in a directory <noreply@gunnar.cc>
Re: remove last 10 lines of all files in a directory <someone@example.com>
Re: remove last 10 lines of all files in a directory <tadmc@augustmail.com>
Re: remove last 10 lines of all files in a directory <uri@stemsystems.com>
Re: Splitting and keeping key/value <tadmc@augustmail.com>
Re: Spreadsheet::ParseExcel on Windows with out Win32:: (reading news)
Re: Spreadsheet::ParseExcel on Windows with out Win32:: <pamelapdh@aol.com>
Re: Spreadsheet::ParseExcel on Windows with out Win32:: <mgarrish@gmail.com>
Re: Spreadsheet::ParseExcel on Windows with out Win32:: <mgarrish@gmail.com>
Re: Spreadsheet::ParseExcel on Windows with out Win32:: (reading news)
Re: Strange output problem <DJStunks@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 26 Sep 2006 20:03:01 -0700
From: "Xah Lee" <xah@xahlee.org>
Subject: Computer Language Popularity Trend
Message-Id: <1159326181.251558.123500@m73g2000cwd.googlegroups.com>
Computer Language Popularity Trend
This page gives a visual report of computer languages's popularity, as
indicated by their traffic level in newsgroups. This is not a
comprehensive or fair survey, but does give some indications of
popularity trends.
http://xahlee.org/lang_traf/index.html
Xah
xah@xahlee.org
=E2=88=91 http://xahlee.org/
------------------------------
Date: 26 Sep 2006 22:56:56 -0700
From: "Danno" <dh.evolutionnext@gmail.com>
Subject: Re: Computer Language Popularity Trend
Message-Id: <1159336615.533487.11890@k70g2000cwa.googlegroups.com>
Xah Lee wrote:
> Computer Language Popularity Trend
>
> This page gives a visual report of computer languages's popularity, as
> indicated by their traffic level in newsgroups. This is not a
> comprehensive or fair survey, but does give some indications of
> popularity trends.
>
> http://xahlee.org/lang_traf/index.html
>
> Xah
> xah@xahlee.org
> =E2=88=91 http://xahlee.org/
Wow, java is a low level industrial language? ;)
------------------------------
Date: 26 Sep 2006 23:48:21 -0700
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: Endless loop in Text::Format::reformat()
Message-Id: <1159339701.341286.303300@h48g2000cwc.googlegroups.com>
Gunnar Hjalmarsson wrote:
> Brian McCauley wrote:
> > Brian McCauley wrote:
> >>
> >>if ( $line =~ /^(.{$min,$opt1}) (.*)/ ||
> >> $line =~ /^(.{$min,$max1}) (.*)/ || $line =~ /^(.{$min,})? (.*)/ )
> >>{
> >> push @output, "$1 ";
> >> $line = $2;
> >>}
> >>
> > If $num_quotes=0 and $line starts with a space then the line
> >
> > $line = '>' x $num_quotes . _stuff($line, $num_quotes);
> >
> > Simply prepends a space to $line and then the code quoted in my
> > previous message simply strips of a leading space.
>
> No, in that case it strips off both the leading spaces, since $min is 1,
> so the contents of $line won't be identical at the next iteration of the
> while loop.
Ah, well since $1 is null we know that /^(.+)? (.*)/ is matching but
the first subexpression is not. As far as I can see this can only be is
there's only one space. Which as you said means I can't explain the
infinite loop.
------------------------------
Date: 26 Sep 2006 15:30:56 -0700
From: "Bill H" <bill@ts1000.us>
Subject: Re: Ftp via Perl cron job
Message-Id: <1159309856.564644.13160@d34g2000cwd.googlegroups.com>
cartercc@gmail.com wrote:
> Bill H wrote:
> > I have a Perl program that processes a file, saves the results in a new
> > file and then need to ftp that file to a different server, can anyone
> > point me to some documentation or a module / source on how I can
> > accomplish the ftp portion via Perl?
>
> #!/usr/bin/perl
> use strict;
> use Net::FTP;
>
> # Step 1 - set variables to your specifications
> my ($server, $username, $password, $directory, $holdfile);
>
> # Step 2 -- FTP to server and download the holdfile
> my $ftp = Net::FTP->new($server, Debug => 0) or die "Cannot connect,
> $@";
> $ftp->login($username, $password) or die "Cannot login ", $ftp->
> message;
> $ftp->cwd($dirctory) or die "Cannot change working directory ",
> $ftp->message;
> $ftp->ascii;
> $ftp->get($holdfile) or die "Cannot get $holdfile ", $ftp->message;
> $ftp->quit;
>
> exit();
>
>
> CC
Thanks for all the information. After posting this quested I started
searching and came across the Net::FTP way of doing it. You posting the
same information makes me feel better about using it. Any idea how to
use secure ftp?
Bill H
------------------------------
Date: Tue, 26 Sep 2006 22:31:57 +0000 (UTC)
From: Hemant Shah <shah@typhoon.xnet.com>
Subject: Need help with pattern matching/substitution.
Message-Id: <efc9ot$26h$1@new7.xnet.com>
Folks,
I have a script that reads data from a file. Each line in a file is comma
seperated list of values.
Example:
DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE '
DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
I want to check if any value contains a quote and add another quote to it.
Example:
DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE '
DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN''T DELETE '
How to I formulate a pattern for substitution?
Thanks.
--
Hemant Shah /"\ ASCII ribbon campaign
E-mail: NoJunkMailshah@xnet.com \ / ---------------------
X against HTML mail
TO REPLY, REMOVE NoJunkMail / \ and postings
FROM MY E-MAIL ADDRESS.
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind, Above opinions are mine only.
it's backed up on tape somewhere. Others can have their own.
------------------------------
Date: 27 Sep 2006 06:12:30 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: Need help with pattern matching/substitution.
Message-Id: <slrnehk5ic.40l.abigail@alexandra.abigail.be>
Hemant Shah (shah@typhoon.xnet.com) wrote on MMMMDCCLXXIV September
MCMXCIII in <URL:news:efc9ot$26h$1@new7.xnet.com>:
``
`` Folks,
``
`` I have a script that reads data from a file. Each line in a file is comma
`` seperated list of values.
``
`` Example:
``
`` DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE '
`` DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN'T DELETE '
``
`` I want to check if any value contains a quote and add another quote to it.
``
`` Example:
``
`` DWH_TRRM|'001','A000855747',100,'02-20-2006','CAN DELETE '
`` DWH_TRRM|'002','A000855737',146,'02-20-2006','CAN''T DELETE '
``
``
`` How to I formulate a pattern for substitution?
You can't. Apparently, there's some magic involved to determine that
the first value, DWH_TRRM|'002' doesn't contain internal quotes, while
'CAN'T DELETE does.
Abigail
--
$_ = "\112\165\163\1648\141\156\157\164\150\145\1628\120\145"
. "\162\1548\110\141\143\153\145\162\0128\177" and &japh;
sub japh {print "@_" and return if pop; split /\d/ and &japh}
------------------------------
Date: Tue, 26 Sep 2006 17:33:06 -0700
From: "J. Fowler" <user@example.invalid>
Subject: Re: Net::LDAP help....
Message-Id: <hEjSg.2$n5.1443@nntp.csufresno.edu>
lancerset@gmail.com wrote:
> Hello All,
> I am having a problem with getting this to work. In this code section
> I'm fetching data from mysql and assigning it to the array @Users
> array. $Users[0] contains username and $Users[1] contains the password.
> So i'm trying to add this info to my ldap server. The script runs, but
> ldap does not contain the new entry. I'm not sure if this is a good way
> to go about this. Any suggestions ??? Thanks,
>
> use Net::LDAP::Entry;
> while ( @Users = $sth->fetchrow_array( ) ) {
> $entry = Net::LDAP::Entry->new;
> $entry->dn($host);
the DN probably isn't going to be $host, but something like:
uid=bob969,cn=users,dc=example,dc=com
Of course, if you are adding, the DN doesn't already exist ...
> $entry->add('uid' => '$Users[0]' );
no single quotes ... as other have pointed out.
You could also:
$entry->add (
'userPassword' => $Users[1],
'givenName' => $Users[0],
etc => etc
);
> $entry->add('userPassword' => '$Users[1]' );
> $entry->add('givenName' => '$Users[0]' );
> $entry->add('loginShell' => '/bin/bash' );
> $entry->add('gidNumber' => '2222' );
> $entry->add('homeDirectory' => '/home/ftpusers/$Users[0]' );
> $entry->add('objectClass' => 'top');
> $entry->add('objectClass' => 'person');
> $entry->add('objectClass' => 'posixAccount');
> }
>
Don't forget to call "update" when you have finished making changes.
$entry->update();
------------------------------
Date: Wed, 27 Sep 2006 04:42:10 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Sep 27 2006
Message-Id: <J68IEA.1qEJ@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
Acme-MetaSyntactic-0.93
http://search.cpan.org/~book/Acme-MetaSyntactic-0.93/
Themed metasyntactic variables names
----
Algorithm-Cluster-1.33
http://search.cpan.org/~mdehoon/Algorithm-Cluster-1.33/
Perl interface to the C Clustering Library.
----
Apache-Session-Wrapper-0.33
http://search.cpan.org/~drolsky/Apache-Session-Wrapper-0.33/
A simple wrapper around Apache::Session
----
Business-US-USPS-WebTools-0.10_02
http://search.cpan.org/~bdfoy/Business-US-USPS-WebTools-0.10_02/
Use the US Postal Service Web Tools
----
CPAN-Cache-0.02
http://search.cpan.org/~adamk/CPAN-Cache-0.02/
Abstract locally-cached logical subset of a CPAN mirror
----
CPAN-Index-0.01
http://search.cpan.org/~adamk/CPAN-Index-0.01/
Robust and object-oriented access to the CPAN index
----
Catalyst-Plugin-C3-0.01
http://search.cpan.org/~blblack/Catalyst-Plugin-C3-0.01/
Catalyst Plugin to subvert NEXT to use Class::C3
----
Catalyst-Plugin-I18N-Request-0.02
http://search.cpan.org/~adapay/Catalyst-Plugin-I18N-Request-0.02/
A plugin for localizing/delocalizing paths and parameters.
----
DBIx-SearchBuilder-1.45
http://search.cpan.org/~jesse/DBIx-SearchBuilder-1.45/
Encapsulate SQL queries and rows in simple perl objects
----
Directory-Scratch-0.09
http://search.cpan.org/~jrockway/Directory-Scratch-0.09/
Easy-to-use self-cleaning scratch space.
----
Konstrukt-0.5-beta1
http://search.cpan.org/~twittek/Konstrukt-0.5-beta1/
Web application/design framework
----
Konstrukt-0.5-beta2
http://search.cpan.org/~twittek/Konstrukt-0.5-beta2/
Web application/design framework
----
LEGO-NXT-1.41
http://search.cpan.org/~collins/LEGO-NXT-1.41/
LEGO NXT Direct Commands API.
----
Mail-Box-2.068
http://search.cpan.org/~markov/Mail-Box-2.068/
manage a mailbox, a folder with messages
----
Mail-DeliveryStatus-BounceParser-1.516
http://search.cpan.org/~rjbs/Mail-DeliveryStatus-BounceParser-1.516/
Perl extension to analyze bounce messages
----
Mail-Karmasphere-Client-2.03
http://search.cpan.org/~shevek/Mail-Karmasphere-Client-2.03/
Client for Karmasphere Reputation Server
----
Module-Build-Convert-0.35
http://search.cpan.org/~schubiger/Module-Build-Convert-0.35/
Makefile.PL to Build.PL converter
----
Module-Build-Convert-0.36
http://search.cpan.org/~schubiger/Module-Build-Convert-0.36/
Makefile.PL to Build.PL converter
----
Module-Build-Convert-0.37
http://search.cpan.org/~schubiger/Module-Build-Convert-0.37/
Makefile.PL to Build.PL converter
----
Module-Collection-0.02
http://search.cpan.org/~adamk/Module-Collection-0.02/
Examine a group of Perl distributions
----
Module-Release-1.11
http://search.cpan.org/~bdfoy/Module-Release-1.11/
Automate software releases
----
Net-SSH2-0.09
http://search.cpan.org/~dbrobins/Net-SSH2-0.09/
Support for the SSH 2 protocol via libSSH2.
----
OODoc-0.95
http://search.cpan.org/~markov/OODoc-0.95/
object oriented production of code related documentation
----
PAR-0.954
http://search.cpan.org/~smueller/PAR-0.954/
Perl Archive Toolkit
----
POD2-FR-0.02
http://search.cpan.org/~polgab/POD2-FR-0.02/
French translation of Perl core documentation
----
POE-Component-AI-MegaHAL-1.03
http://search.cpan.org/~bingos/POE-Component-AI-MegaHAL-1.03/
A non-blocking wrapper around AI::MegaHAL.
----
POE-Component-Client-HTTP-0.78
http://search.cpan.org/~rcaputo/POE-Component-Client-HTTP-0.78/
a HTTP user-agent component
----
POE-Component-Client-Keepalive-0.0901
http://search.cpan.org/~rcaputo/POE-Component-Client-Keepalive-0.0901/
manage connections, with keep-alive
----
POE-Component-IRC-Service-0.991
http://search.cpan.org/~bingos/POE-Component-IRC-Service-0.991/
a fully event driven IRC Services module
----
POE-Component-Server-Chargen-1.03
http://search.cpan.org/~bingos/POE-Component-Server-Chargen-1.03/
a POE component implementing a RFC 864 Chargen server.
----
POE-Component-Server-DNS-0.02
http://search.cpan.org/~bingos/POE-Component-Server-DNS-0.02/
non-blocking, concurrent DNS server component
----
POE-Component-Server-Daytime-1.03
http://search.cpan.org/~bingos/POE-Component-Server-Daytime-1.03/
a POE component implementing a RFC 865 Daytime server.
----
POE-Component-Server-Discard-1.03
http://search.cpan.org/~bingos/POE-Component-Server-Discard-1.03/
a POE component implementing a RFC 863 Discard server.
----
POE-Component-Server-Echo-1.4
http://search.cpan.org/~bingos/POE-Component-Server-Echo-1.4/
a POE component implementing a RFC 862 Echo server.
----
POE-Component-Server-IRC-1.00
http://search.cpan.org/~bingos/POE-Component-Server-IRC-1.00/
a fully event-driven networkable IRC server daemon module.
----
POE-Component-Server-Qotd-1.03
http://search.cpan.org/~bingos/POE-Component-Server-Qotd-1.03/
a POE component implementing a RFC 865 QotD server.
----
POE-Component-Server-Time-1.03
http://search.cpan.org/~bingos/POE-Component-Server-Time-1.03/
a POE component implementing a RFC 868 Time server.
----
POE-Component-SimpleDBI-1.15
http://search.cpan.org/~apocal/POE-Component-SimpleDBI-1.15/
Asynchronous non-blocking DBI calls in POE made simple
----
POE-Component-WWW-Shorten-1.03
http://search.cpan.org/~bingos/POE-Component-WWW-Shorten-1.03/
A non-blocking wrapper around WWW::Shorten.
----
POE-Component-Win32-ChangeNotify-1.03
http://search.cpan.org/~bingos/POE-Component-Win32-ChangeNotify-1.03/
A POE wrapper around Win32::ChangeNotify.
----
POE-Component-Win32-EventLog-1.07
http://search.cpan.org/~bingos/POE-Component-Win32-EventLog-1.07/
A POE component that provides non-blocking access to Win32::EventLog.
----
POE-Component-Win32-Service-1.04
http://search.cpan.org/~bingos/POE-Component-Win32-Service-1.04/
A POE component that provides non-blocking access to Win32::Service.
----
POE-Filter-CSV-1.03
http://search.cpan.org/~bingos/POE-Filter-CSV-1.03/
A POE-based parser for CSV based files.
----
POE-Filter-LZF-1.5
http://search.cpan.org/~bingos/POE-Filter-LZF-1.5/
A POE filter wrapped around Compress::LZF
----
POE-Filter-LZO-1.5
http://search.cpan.org/~bingos/POE-Filter-LZO-1.5/
A POE filter wrapped around Compress::LZO
----
POE-Filter-LZW-1.5
http://search.cpan.org/~bingos/POE-Filter-LZW-1.5/
A POE filter wrapped around Compress::LZW
----
POE-Filter-Zlib-1.7
http://search.cpan.org/~bingos/POE-Filter-Zlib-1.7/
A POE filter wrapped around Compress::Zlib
----
Pod-Perldoc-ToToc-1.04
http://search.cpan.org/~bdfoy/Pod-Perldoc-ToToc-1.04/
Translate Pod to a Table of Contents
----
SWISH-Filter-0.07
http://search.cpan.org/~karman/SWISH-Filter-0.07/
filter documents for indexing with Swish-e
----
Sdict-2.7
http://search.cpan.org/~swaj/Sdict-2.7/
Module to work with Sdictionary .dct files
----
Template-Process-0.0002
http://search.cpan.org/~ferreira/Template-Process-0.0002/
Process TT2 templates against data files
----
Text-MediawikiFormat-0.02
http://search.cpan.org/~dprice/Text-MediawikiFormat-0.02/
Translate Wiki markup into other text formats
----
URI-tag-0.01
http://search.cpan.org/~miyagawa/URI-tag-0.01/
Tag URI Scheme (RFC 4151)
----
URI-urn-uuid-0.02
http://search.cpan.org/~miyagawa/URI-urn-uuid-0.02/
UUID URN Namespace
----
WWW-Sucksub-Extratitles-0.01
http://search.cpan.org/~tfoucart/WWW-Sucksub-Extratitles-0.01/
automated access to Extratitles.com
----
Wiki-Toolkit-Formatter-Mediawiki-0.02
http://search.cpan.org/~dprice/Wiki-Toolkit-Formatter-Mediawiki-0.02/
A Mediawiki-style formatter for Wiki::Toolkit.
----
subatom-0.10
http://search.cpan.org/~hdm/subatom-0.10/
produce an atom feed from subversion commits
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 27 Sep 2006 08:44:48 +0200
From: "Ferry Bolhar" <bol@adv.magwien.gv.at>
Subject: Re: pod - purpose of L<> directive
Message-Id: <1159339489.186414@proxy.dienste.wien.at>
Christian Winter:
> As I wrote a few days ago on the same question in the German group,
> you have to set --podroot and --podpath. Additionally, you may have
> to set --libpods to include documents with linkable items.
> pod2html doesn't search the standard perl include paths.
Well, you wrote on the same question twice, and your answer
didn't help me twice. I played around with --podroot, --podpath
and --libpods, but got always the same error message.
Perhaps someone has further experience with pod2html and L<>
directives and can post concrete examples?
MTIA and kind greetings from Vienna,
Ferry
--
Ing Ferry Bolhar
Magistrat der Stadt Wien - MA 14
A-1010 Wien
E-Mail: bol@adv.magwien.gv.at
------------------------------
Date: 26 Sep 2006 20:09:57 -0700
From: "jialin" <JialinLi1981@gmail.com>
Subject: question about $list[1] x @list2
Message-Id: <1159326597.544416.214250@h48g2000cwc.googlegroups.com>
@list1 = qw/aa ab ac/;
@list2 = qw/1 2 3 4 5/;
print $list1[2] x @list2,"\n";
========
i know the output will be "acacacacac",
but what this x means in $list1[2] x @list2,
thanks,
Jialin
------------------------------
Date: 26 Sep 2006 20:21:12 -0700
From: "jialin" <JialinLi1981@gmail.com>
Subject: Re: question about $list[1] x @list2
Message-Id: <1159327272.020561.36000@i3g2000cwc.googlegroups.com>
I found the answer from perlop
Binary "x" is the repetition operator. In scalar context or if
the
left operand is not enclosed in parentheses, it returns a string
con-
sisting of the left operand repeated the number of times
specified by
the right operand. In list context, if the left operand is
enclosed in
parentheses, it repeats the list. If the right operand is zero
or neg-
ative, it returns an empty string or an empty list, depending on
the
context.
print '-' x 80; # print row of dashes
print "\t" x ($tab/8), ' ' x ($tab%8); # tab over
@ones = (1) x 80; # a list of 80 1's
@ones = (5) x @ones; # set all elements to 5
jialin wrote:
> @list1 = qw/aa ab ac/;
> @list2 = qw/1 2 3 4 5/;
> print $list1[2] x @list2,"\n";
>
> ========
> i know the output will be "acacacacac",
> but what this x means in $list1[2] x @list2,
>
> thanks,
> Jialin
------------------------------
Date: 26 Sep 2006 21:40:18 -0700
From: "Harpreet" <harpreet.saluja@gmail.com>
Subject: Re: Reading from standard input
Message-Id: <1159332018.369136.288550@k70g2000cwa.googlegroups.com>
Thanks John ! I finally understood the concept of '-' stream.
Harpreet
John W. Krahn wrote:
> Harpreet wrote:
> >
> > I am learning perl scripting and was reading an online tutorial where i
> > encountered this code(at the end of message). The first part of the
> > code (reading from file) has been pasted as-is and the second(reading
> > from standard input stream) was written by me. When I execute the
> > program, I get the correct result from the first one and then I type
> > into the stream some data but I don't know how to end it. I used the
> > conventional unix "dot-enter" scheme but it didn't work. Neither did
> > Ctrl-D. I found some examples which read from <STDIN> and worked with a
> > while loop. Can somebody explain me why reading from the standard input
> > doesn't work the way I have written ?
>
> Because you are not reading from the standard input.
>
> > If I am missing the escape
> > character to denote the end of stream, please mention it.
> >
> > Any pointers will be appreciated.
> >
> >
> > <CODE>
> > #!usr/local/bin/perl
>
> You are using a relative path when you should be using an absolute path:
>
> #!/usr/local/bin/perl
>
> And don't forget:
>
> use warnings;
> use strict;
>
>
> > $file = '/etc/passwd'; # Name the file
> > open(INFO, $file); # Open the file
>
> You should *ALWAYS* verify that the file opened correctly:
>
> open(INFO, $file) or die "Cannot open '$file' $!";
>
> > @lines = <INFO>; # Read it into an array
> > close(INFO); # Close the file
> > print @lines; # Print the array
> >
> > open(INFO, '-');
>
> You should *ALWAYS* verify that the file opened correctly:
>
> open(INFO, '-') or die "Cannot open '-' $!";
>
> You are trying to open the file '-', standard input is not involved when
> opening a plain file.
>
> The *only* time that '-' has anything to do with standard input is when @ARGV
> and <> are used:
>
> local @ARGV = '-';
>
> while ( <> ) { # read from STDIN because @ARGV contains '-'
> print;
> }
>
> > @lines2 = <INFO>; # Read it into an array
> > close(INFO);
> > print @lines2;
> > </CODE>
>
>
>
> John
> --
> use Perl;
> program
> fulfillment
------------------------------
Date: Tue, 26 Sep 2006 15:36:50 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: remove last 10 lines of all files in a directory
Message-Id: <3lmou3xbem.ln2@goaway.wombat.san-francisco.ca.us>
On 2006-09-26, rsarpi@gmail.com <rsarpi@gmail.com> wrote:
>
> And for some reason globbing doesn't do the
> trick...like glob ("*.*");
That's not globbing all the files: perldoc -q glob
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Wed, 27 Sep 2006 00:49:42 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: remove last 10 lines of all files in a directory
Message-Id: <4ntp47Fc4a5qU1@individual.net>
rsarpi@gmail.com wrote:
> Objective: remove last 10 lines of *all* files in a directory with no
> branches.
perldoc -f readdir
perldoc -q "delete a line"
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 26 Sep 2006 22:52:58 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: remove last 10 lines of all files in a directory
Message-Id: <ebiSg.35833$cz3.25579@edtnps82>
rsarpi@gmail.com wrote:
> using perl 5.8.8
>
> Objective: remove last 10 lines of *all* files in a directory with no
> branches.
>
> Like...xfiles directory has the files xfile1...xfile10. No
> subdirectories. I want to remove the last 10 lines of xfile1...xfile10.
>
> How do I do that?
>
> I've tried to put all files in an array but I can't open all files at
> one to write to them. And for some reason globbing doesn't do the
> trick...like glob ("*.*");
>
> I came up with something to delete the last 10 lines of ONE file only.
> (A portion of this code is mine the other is from the perl cookbook)
> ----------
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
>
> my $path = "C:/path/to/file.txt";
>
> my $addr = "";
>
> #create a sentinel value
> my $counter = 1;
>
> #kicks out after it reaches line 10. We just want to delete 10 lines
> while ( $counter <= 10 ) {
> open( FH, "+< $path" ) or die $!;
> while (<FH>) {
> $addr = tell(FH) unless eof(FH);
> }
> truncate( FH, $addr ) or die $!;
>
> #update sentinel value
> $counter++;
> }
> print "all done\n";
I don't have Windows to test this on but it works on Linux:
#!/usr/bin/perl
use warnings;
use strict;
@ARGV = <C:/path/to/*>;
my @addrs;
while ( <> ) {
push @addrs, tell ARGV;
if ( eof ) {
my $file = $ARGV;
close ARGV;
truncate $file, ( splice @addrs )[ -11 ];
}
}
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Tue, 26 Sep 2006 17:56:16 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: remove last 10 lines of all files in a directory
Message-Id: <slrnehjc0g.9b3.tadmc@magna.augustmail.com>
rsarpi@gmail.com <rsarpi@gmail.com> wrote:
> Objective: remove last 10 lines of *all* files in a directory with no
> branches.
> How do I do that?
my @all_files = grep { -f } glob '* .*'; # untested
> I came up with something to delete the last 10 lines of ONE file only.
Then put that in a subroutine and call the subroutine a bunch of times:
foreach my $filename ( @all_files ) {
delete_last_10_lines( $filename );
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 27 Sep 2006 00:10:42 -0400
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: remove last 10 lines of all files in a directory
Message-Id: <x7zmcmrltp.fsf@mail.sysarch.com>
>>>>> "JWK" == John W Krahn <someone@example.com> writes:
JWK> @ARGV = <C:/path/to/*>;
JWK> my @addrs;
JWK> while ( <> ) {
JWK> push @addrs, tell ARGV;
JWK> if ( eof ) {
JWK> my $file = $ARGV;
JWK> close ARGV;
JWK> truncate $file, ( splice @addrs )[ -11 ];
JWK> }
JWK> }
that leads me to say to use File::ReadBackwards to get the location of
the 10th to last line and then truncate. <untested and pseudoish>
use File::ReadBackwards ;
my $fh = File::ReadBackwards->new( $file ) ;
$fh->readline() for 1 .. 10 ;
truncate $file, $fh->tell() ;
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Tue, 26 Sep 2006 17:41:54 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Splitting and keeping key/value
Message-Id: <slrnehjb5i.9b3.tadmc@magna.augustmail.com>
Sandman <mr@sandman.net> wrote:
> I keep getting reminded
An easy way to avoid that would be to stop coming back.
> of what a bunch of idiots this group harbors
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 26 Sep 2006 22:50:55 GMT
From: "Mumia W. (reading news)" <paduille.4058.mumia.w@earthlink.net>
Subject: Re: Spreadsheet::ParseExcel on Windows with out Win32::OLE
Message-Id: <j9iSg.12981$v%4.1105@newsread1.news.pas.earthlink.net>
On 09/26/2006 04:34 PM, Pam wrote:
> Hello:
>
> I was wondering if anyone knew if it was possible to Parse a file in
> the Windows
> enviroment without using the Win32::OLE? Most of the sample code I see
> is either
> writen for UNIX/Linux or Win32:OLE. Currently I have a Perl script
> running on Unix
> on a cron job that works fine and I wrote it in the Windows enviroment
> but used the
> Spreadsheet:WriteExcel module and other modules which also works in the
> UNIX enviroment. Now I am trying to add more code that will parse the
> file for a value. But I am having the hardest time I work in the
> Windows enviroment and the code is put on UNIX by another group so
> right now I don't have access to UNIX so my code must be written in
> Windows. Since previous code was writen using Spreadsheet::WriteExcel,
> OLE dosen't seem to work with existing code because one writes to a
> sheet and Win32::OLE uses Workbook at least that is my conclusion from
> all of my efforts in trying to get my code working. I am trying to
> parse an existing spreadsheet with
>
> $oBook = Spreadsheet::ParseExcel::Workbook->Parse($original_file)
>
> Am I correct in my conclusions? If anyone can answer this I would
> greatly appreciate it.
>
>
> Pam
>
You are correct. Win32::OLE most probably won't work with code written
for Spreadsheet::{Parse,Write}Excel.
--
paduille.4058.mumia.w@earthlink.net
------------------------------
Date: 26 Sep 2006 16:11:20 -0700
From: "Pam" <pamelapdh@aol.com>
Subject: Re: Spreadsheet::ParseExcel on Windows with out Win32::OLE
Message-Id: <1159312280.651230.25450@i3g2000cwc.googlegroups.com>
Mumia W. (reading news) wrote:
> On 09/26/2006 04:34 PM, Pam wrote:
> > Hello:
> >
> > I was wondering if anyone knew if it was possible to Parse a file in
> > the Windows
> > enviroment without using the Win32::OLE? Most of the sample code I see
> > is either
> > writen for UNIX/Linux or Win32:OLE. Currently I have a Perl script
> > running on Unix
> > on a cron job that works fine and I wrote it in the Windows enviroment
> > but used the
> > Spreadsheet:WriteExcel module and other modules which also works in the
> > UNIX enviroment. Now I am trying to add more code that will parse the
> > file for a value. But I am having the hardest time I work in the
> > Windows enviroment and the code is put on UNIX by another group so
> > right now I don't have access to UNIX so my code must be written in
> > Windows. Since previous code was writen using Spreadsheet::WriteExcel,
> > OLE dosen't seem to work with existing code because one writes to a
> > sheet and Win32::OLE uses Workbook at least that is my conclusion from
> > all of my efforts in trying to get my code working. I am trying to
> > parse an existing spreadsheet with
> >
> > $oBook = Spreadsheet::ParseExcel::Workbook->Parse($original_file)
> >
> > Am I correct in my conclusions? If anyone can answer this I would
> > greatly appreciate it.
> >
> >
> > Pam
> >
>
> You are correct. Win32::OLE most probably won't work with code written
> for Spreadsheet::{Parse,Write}Excel.
>
> --
> paduille.4058.mumia.w@earthlink.net
Hi
Do you know if Spreadsheet::ParseExcel can work on Windows without
using
Win32::OLE?
Pam
------------------------------
Date: 26 Sep 2006 16:36:36 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: Spreadsheet::ParseExcel on Windows with out Win32::OLE
Message-Id: <1159313796.281982.201030@i42g2000cwa.googlegroups.com>
Pam wrote:
> Mumia W. (reading news) wrote:
> > On 09/26/2006 04:34 PM, Pam wrote:
> > > Hello:
> > >
> > > I was wondering if anyone knew if it was possible to Parse a file in
> > > the Windows
> > > enviroment without using the Win32::OLE? Most of the sample code I see
> > > is either
> > > writen for UNIX/Linux or Win32:OLE. Currently I have a Perl script
> > > running on Unix
> > > on a cron job that works fine and I wrote it in the Windows enviroment
> > > but used the
> > > Spreadsheet:WriteExcel module and other modules which also works in the
> > > UNIX enviroment.
> >
> > You are correct. Win32::OLE most probably won't work with code written
> > for Spreadsheet::{Parse,Write}Excel.
> >
>
> Do you know if Spreadsheet::ParseExcel can work on Windows without
> using
> Win32::OLE?
>
Could you please point out the exact passage in the ParseExcel
documentation where it says that Win32::OLE is required? I'm having
trouble finding it.
Matt
------------------------------
Date: 26 Sep 2006 17:34:19 -0700
From: "Matt Garrish" <mgarrish@gmail.com>
Subject: Re: Spreadsheet::ParseExcel on Windows with out Win32::OLE
Message-Id: <1159317259.277295.162380@i3g2000cwc.googlegroups.com>
Pam wrote:
> Mumia W. (reading news) wrote:
> > On 09/26/2006 04:34 PM, Pam wrote:
> > > Hello:
> > >
> > > I was wondering if anyone knew if it was possible to Parse a file in
> > > the Windows
> > > enviroment without using the Win32::OLE? Most of the sample code I see
> > > is either
> > > writen for UNIX/Linux or Win32:OLE. Currently I have a Perl script
> > > running on Unix
> > > on a cron job that works fine and I wrote it in the Windows enviroment
> > > but used the
> > > Spreadsheet:WriteExcel module and other modules which also works in the
> > > UNIX enviroment.
> >
> > You are correct. Win32::OLE most probably won't work with code written
> > for Spreadsheet::{Parse,Write}Excel.
> >
>
> Do you know if Spreadsheet::ParseExcel can work on Windows without
> using
> Win32::OLE?
>
Could you please point out the exact passage in the ParseExcel
documentation where it says that Win32::OLE is required? I'm having
trouble finding it.
Matt
------------------------------
Date: Wed, 27 Sep 2006 01:07:19 GMT
From: "Mumia W. (reading news)" <paduille.4058.mumia.w@earthlink.net>
Subject: Re: Spreadsheet::ParseExcel on Windows with out Win32::OLE
Message-Id: <b9kSg.1775$Y24.338@newsread4.news.pas.earthlink.net>
On 09/26/2006 06:11 PM, Pam wrote:
> Mumia W. (reading news) wrote:
>> On 09/26/2006 04:34 PM, Pam wrote:
>>> Hello:
>>>
>>> I was wondering if anyone knew if it was possible to Parse a file in
>>> the Windows
>>> enviroment without using the Win32::OLE? Most of the sample code I see
>>> is either
>>> writen for UNIX/Linux or Win32:OLE. Currently I have a Perl script
>>> running on Unix
>>> on a cron job that works fine and I wrote it in the Windows enviroment
>>> but used the
>>> Spreadsheet:WriteExcel module and other modules which also works in the
>>> UNIX enviroment. Now I am trying to add more code that will parse the
>>> file for a value. But I am having the hardest time I work in the
>>> Windows enviroment and the code is put on UNIX by another group so
>>> right now I don't have access to UNIX so my code must be written in
>>> Windows. Since previous code was writen using Spreadsheet::WriteExcel,
>>> OLE dosen't seem to work with existing code because one writes to a
>>> sheet and Win32::OLE uses Workbook at least that is my conclusion from
>>> all of my efforts in trying to get my code working. I am trying to
>>> parse an existing spreadsheet with
>>>
>>> $oBook = Spreadsheet::ParseExcel::Workbook->Parse($original_file)
>>>
>>> Am I correct in my conclusions? If anyone can answer this I would
>>> greatly appreciate it.
>>>
>>>
>>> Pam
>>>
>> You are correct. Win32::OLE most probably won't work with code written
>> for Spreadsheet::{Parse,Write}Excel.
>>
>> --
>> paduille.4058.mumia.w@earthlink.net
>
>
> Hi
>
> Do you know if Spreadsheet::ParseExcel can work on Windows without
> using
> Win32::OLE?
>
>
> Pam
>
I've had no experience with Spreadsheet::ParseExcel outside of Linux.
However, there is a 99% + 1% chance that Spreadsheet::ParseExcel has no
dependency upon Win32::OLE since Win32::OLE only works under Windows,
and Spreadsheet::ParseExcel doesn't only work under Windows.
Try it for yourself. See if you can write a perl script that uses
Spreadsheet::ParseExcel and not Win32::OLE to parse an Excel file.
--
paduille.4058.mumia.w@earthlink.net
------------------------------
Date: 26 Sep 2006 15:06:16 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: Strange output problem
Message-Id: <1159308376.506342.196830@d34g2000cwd.googlegroups.com>
Peter J. Holzer wrote:
> sub html_escape {
> my $s = @_;
> $s =~ s/&/&/;
> $s =~ s/</</;
> $s =~ s/>/>/; # only for symmetry
> $s =~ s/"/&dquot;/; # only needed in attributes
> $s =~ s/'/'/; # only needed in attributes
> return $s;
> }
use CGI qw{ escapeHTML };
-jp
------------------------------
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 V10 Issue 9773
***************************************