[30190] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1433 Volume: 11

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 9 03:09:43 2008

Date: Wed, 9 Apr 2008 00:09: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, 9 Apr 2008     Volume: 11 Number: 1433

Today's topics:
    Re: Can I iterate through a file on a CGI  page? <jimsgibson@gmail.com>
    Re: can you write to a dos format while in unix <jimsgibson@gmail.com>
    Re: can you write to a dos format while in unix <mmccaws@comcast.net>
    Re: can you write to a dos format while in unix <joost@zeekat.nl>
    Re: How to monitor keyboard inactivity from script <mmccaws@comcast.net>
        new CPAN modules on Wed Apr  9 2008 (Randal Schwartz)
        Perl Regex substitution: replace nth occurrance <yogeshkagrawal@gmail.com>
    Re: Perl Regex substitution: replace nth occurrance <devnull4711@web.de>
    Re: perl should be improved and perl6 <tadmc@seesig.invalid>
    Re: perl should be improved and perl6 <get@bentsys.com>
    Re: perl should be improved and perl6 <kkeller-usenet@wombat.san-francisco.ca.us>
    Re: perl should be improved and perl6 <get@bentsys.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 08 Apr 2008 16:12:14 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: Can I iterate through a file on a CGI  page?
Message-Id: <080420081612147844%jimsgibson@gmail.com>

In article <47fbe8c0$0$33227$815e3792@news.qwest.net>, J. Gleixner
<glex_no-spam@qwest-spam-no.invalid> wrote:

> Rich Grise wrote:
> > On Tue, 08 Apr 2008 17:34:35 +0000, Rich Grise wrote:
> > 
> >> the actual file that the link is pointing to? I suppose I could do an ls
> >> -l and parse the link, but isn't there an easier/quicker/more elegant way
> >> to get that info? (I think they call it "dereferencing", but I'm not sure.)
> > 
> > Nah:
> > ### start script ###
> > #!/usr/bin/perl -w
> > 
> > my $line=`ls -l source-links | head -2 | tail -1`;
> > 
> > chomp $line;
> > 
> > my $linkname = substr("$line", 50, 12);
> > my $targetname = substr("$line", 66);
> > 
> > print("$line\n");
> > 
> > print("name = $linkname, target = $targetname\n");
> 
> Do you have your own print() subroutine?  No need for '()'.
> 
> > ### end script ###
> > 
> > $ parse-ls
> > lrwxrwxrwx 1 richgrise users  75 2008-04-07 13:47 symlink00000 ->
> > /C/Documents and Settings/Administrator/My Documents/My Pictures/Sample.jpg
> > name = symlink00000, target = /C/Documents and Settings/Administrator/My
> > Documents/My Pictures/Sample.jpg
> 
> Not very reliable.  If the owner or group change to something
> of different length, it could easily return the wrong data. Using
> split would be more reliable, but still not very good.
> 
> Use the correct function: perldoc -f readlink

This should work and doesn't require shelling out to ls:

use strict;
use warnings;
use File::Find;
find( 
  sub {
    my $linkname = $_;
    return unless -l $_;
    my $targetname = readlink $linkname;
    print "name = $linkname, target = $targetname\n";
  },
  'source-links'
);

-- 
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Tue, 08 Apr 2008 16:22:22 -0700
From: Jim Gibson <jimsgibson@gmail.com>
Subject: Re: can you write to a dos format while in unix
Message-Id: <080420081622224310%jimsgibson@gmail.com>

In article
<9ad7dab3-81b9-4afb-be94-c5706f2e347e@p25g2000hsf.googlegroups.com>,
mmccaws2 <mmccaws@comcast.net> wrote:


> How does one print hidden characters like '\n' in perl or cl?

You change them to something printable:

  $line = "123\n";
  $line =~ s{\n}{\\n\n}g;   # '123\n'

or maybe

  $line =~ s{([[:cntrl:]]}{sprintf"\\%x\n",ord($1)}eg;  # '123\a'
  print $line;

-- 
Jim Gibson

 Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
    ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------        
                http://www.usenet.com


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

Date: Tue, 8 Apr 2008 17:09:12 -0700 (PDT)
From: mmccaws2 <mmccaws@comcast.net>
Subject: Re: can you write to a dos format while in unix
Message-Id: <868bccad-abac-4f2a-9cfa-c6995e231795@l42g2000hsc.googlegroups.com>

On Apr 8, 4:22 pm, Jim Gibson <jimsgib...@gmail.com> wrote:
> In article
> <9ad7dab3-81b9-4afb-be94-c5706f2e3...@p25g2000hsf.googlegroups.com>,
>
> mmccaws2 <mmcc...@comcast.net> wrote:
> > How does one print hidden characters like '\n' in perl or cl?
>
> You change them to something printable:
>
>   $line = "123\n";
>   $line =~ s{\n}{\\n\n}g;   # '123\n'
>
> or maybe
>
>   $line =~ s{([[:cntrl:]]}{sprintf"\\%x\n",ord($1)}eg;  # '123\a'
>   print $line;
>
> --
> Jim Gibson
>
>  Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
>     ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
>                http://www.usenet.com

Thanks I should've, could've thought of that, but I hadn't

Mike


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

Date: Wed, 09 Apr 2008 02:09:52 +0200
From: Joost Diepenmaat <joost@zeekat.nl>
Subject: Re: can you write to a dos format while in unix
Message-Id: <87skxv3n3j.fsf@zeekat.nl>

Rich Grise <rich@example.net> writes:


> What's wrong with 
> $ todos < $infile > $dosfile
> ?

Nothing if you have it. Same for unix2dos etc. FTR: I seem to have
neither on my debian box which has been in use for years.

-- 
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/


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

Date: Tue, 8 Apr 2008 17:16:51 -0700 (PDT)
From: mmccaws2 <mmccaws@comcast.net>
Subject: Re: How to monitor keyboard inactivity from script
Message-Id: <5945bc25-777a-4f29-9a68-48885bd8e862@p25g2000hsf.googlegroups.com>

On Apr 2, 12:24 pm, J=FCrgen Exner <jurge...@hotmail.com> wrote:
> mmccaws2 <mmcc...@comcast.net> wrote:
> >I have a user interface script that makes changes in a db or makes db
> >queries.  I don't want the user to just leave the script running all
> >the time.  what is the best way to monitor if the script has had no
> >actiivty for 20 minutes?
>
> I can think of basically 2 different approaches:
> A: the script monitors its own time =3D=3D> do not have the script wait fo=
r
> user input, but check in regular intervals if input is available. If no
> input, then go to sleep() again for another x seconds unless the total
> wait time already exceeds those 20 minutes.
> B: use a second process as the watchdog =3D=3D> whenever the script
> processes some user input it will also signal the watchdog process which
> will reset its internal timer. If the timer hasn't been reset for 20
> minutes (perldoc -q timeout) then kill() the master script.
>
> jue

here's my half cent on this

ReadMode 4;
   my $key;
   my $perltime =3D time() + 300;
   while (not defined ($key =3D ReadKey(-1))) {
      #No key yet
      my $time =3D time();
      if ($time > $perltime) {exit;}
      }
   ReadMode 0; # reset tty

Thanks everyone.


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

Date: Wed, 9 Apr 2008 04:42:19 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Wed Apr  9 2008
Message-Id: <Jz1JqJ.1HGz@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.

Algorithm-LBFGS-0.173
http://search.cpan.org/~laye/Algorithm-LBFGS-0.173/
Perl extension for L-BFGS 
----
Apache2-ClickPath-1.901
http://search.cpan.org/~opi/Apache2-ClickPath-1.901/
Apache WEB Server User Tracking 
----
App-Asciio-0.95_01
http://search.cpan.org/~nkh/App-Asciio-0.95_01/
Plain ASCII diagram 
----
App-Modular-0.1.3
http://search.cpan.org/~bcevc/App-Modular-0.1.3/
modularization framework for perl programs 
----
Business-LCCN-0.11
http://search.cpan.org/~anirvan/Business-LCCN-0.11/
Work with Library of Congress Control Number (LCCN) codes 
----
CGI-FileManager-0.06
http://search.cpan.org/~szabgab/CGI-FileManager-0.06/
Managing a directory structure on an HTTP server 
----
Cache-Funky-Storage-Memcached-0.07
http://search.cpan.org/~tomyhero/Cache-Funky-Storage-Memcached-0.07/
Cache::Funky Memcached Storage. 
----
Catalyst-Authentication-Credential-OpenID-0.02
http://search.cpan.org/~ashley/Catalyst-Authentication-Credential-OpenID-0.02/
OpenID credential for Catalyst::Plugin::Authentication framework. 
----
Catalyst-Devel-1.05
http://search.cpan.org/~mramberg/Catalyst-Devel-1.05/
Catalyst Development Tools 
----
Catalyst-Model-CacheFunky-Loader-0.06
http://search.cpan.org/~tomyhero/Catalyst-Model-CacheFunky-Loader-0.06/
Load Cache::Funky Modules. 
----
Catalyst-Plugin-Wizard-0.04
http://search.cpan.org/~davinchi/Catalyst-Plugin-Wizard-0.04/
making multipart (e.g. wizard) actions: registering an user via several steps, submit something large (like application forms). 
----
Catalyst-Plugin-Wizard-0.05
http://search.cpan.org/~davinchi/Catalyst-Plugin-Wizard-0.05/
making multipart (e.g. wizard) actions: registering an user via several steps, submit something large (like application forms). 
----
ClearPress-121
http://search.cpan.org/~rpettett/ClearPress-121/
Simple, fresh & fruity MVC framework 
----
Config-Scoped-0.11_01
http://search.cpan.org/~gaissmai/Config-Scoped-0.11_01/
feature rich configuration file parser 
----
Config-Scoped-0.11_02
http://search.cpan.org/~gaissmai/Config-Scoped-0.11_02/
feature rich configuration file parser 
----
Config-Scoped-0.11_03
http://search.cpan.org/~gaissmai/Config-Scoped-0.11_03/
feature rich configuration file parser 
----
Crypt-ECDSA-0.062
http://search.cpan.org/~billh/Crypt-ECDSA-0.062/
Elliptical Cryptography Digital Signature Algorithm 
----
DBIx-Class-Schema-Loader-0.04005
http://search.cpan.org/~ilmari/DBIx-Class-Schema-Loader-0.04005/
Dynamic definition of a DBIx::Class::Schema 
----
DBIx-DataAudit-0.03
http://search.cpan.org/~corion/DBIx-DataAudit-0.03/
summarize column data for a table 
----
Data-Validate-URI-0.05
http://search.cpan.org/~sonnen/Data-Validate-URI-0.05/
common url validation methods 
----
Devel-PerlySense-0.0151
http://search.cpan.org/~johanl/Devel-PerlySense-0.0151/
Perl IDE with Emacs frontend 
----
Device-Velleman-K8055-Fuse-0.8
http://search.cpan.org/~ronan/Device-Velleman-K8055-Fuse-0.8/
Communication with the Velleman K8055 USB experiment board using Fuse and K8055fs 
----
Device-Velleman-K8055-Fuse-0.9
http://search.cpan.org/~ronan/Device-Velleman-K8055-Fuse-0.9/
Communication with the Velleman K8055 USB experiment board using Fuse and K8055fs 
----
Dynamic-Loader-0.01
http://search.cpan.org/~evaleto/Dynamic-Loader-0.01/
call a script without to know where is it and where are his bundles. 
----
File-Find-Node-0.03
http://search.cpan.org/~scl/File-Find-Node-0.03/
Object oriented directory tree traverser 
----
Gtk2-Net-LDAP-Widgets-2.0.0
http://search.cpan.org/~adamowski/Gtk2-Net-LDAP-Widgets-2.0.0/
LDAP-related widget library for Gtk2 
----
HTML-Encoding-0.57
http://search.cpan.org/~bjoern/HTML-Encoding-0.57/
Determine the encoding of HTML/XML/XHTML documents 
----
HTML-StickyQuery-DoCoMoGUID-0.01
http://search.cpan.org/~yappo/HTML-StickyQuery-DoCoMoGUID-0.01/
add guid query for DoCoMo imode 
----
IO-Moose-0.03
http://search.cpan.org/~dexter/IO-Moose-0.03/
Moose reimplementation of IO::* with improvements 
----
IkiWiki-Plugin-syntax-0.21
http://search.cpan.org/~vmoral/IkiWiki-Plugin-syntax-0.21/
Add syntax highlighting to ikiwiki 
----
Image-Compare-0.5
http://search.cpan.org/~avif/Image-Compare-0.5/
Compare two images in a variety of ways. 
----
Jifty-0.80408
http://search.cpan.org/~sartak/Jifty-0.80408/
an application framework 
----
Jifty-Plugin-OAuth-0.02
http://search.cpan.org/~sartak/Jifty-Plugin-OAuth-0.02/
secure API authentication 
----
Lingua-Han-Cantonese-0.05
http://search.cpan.org/~fayland/Lingua-Han-Cantonese-0.05/
Retrieve the Cantonese(GuangDongHua) of Chinese character(HanZi). 
----
Lingua-Han-PinYin-0.08
http://search.cpan.org/~fayland/Lingua-Han-PinYin-0.08/
Retrieve the Mandarin(PinYin) of Chinese character(HanZi). 
----
Lingua-Han-PinYin-0.09
http://search.cpan.org/~fayland/Lingua-Han-PinYin-0.09/
Retrieve the Mandarin(PinYin) of Chinese character(HanZi). 
----
Lingua-Han-PinYin-0.10
http://search.cpan.org/~fayland/Lingua-Han-PinYin-0.10/
Retrieve the Mandarin(PinYin) of Chinese character(HanZi). 
----
Lingua-Han-Stroke-0.06
http://search.cpan.org/~fayland/Lingua-Han-Stroke-0.06/
Retrieve the stroke count of Chinese character. 
----
Lingua-Han-Utils-0.06
http://search.cpan.org/~fayland/Lingua-Han-Utils-0.06/
The utility tools of Chinese character(HanZi) 
----
Lingua-Han-Utils-0.07
http://search.cpan.org/~fayland/Lingua-Han-Utils-0.07/
The utility tools of Chinese character(HanZi) 
----
Lingua-Han-Utils-0.08
http://search.cpan.org/~fayland/Lingua-Han-Utils-0.08/
The utility tools of Chinese character(HanZi) 
----
Lingua-Han-Utils-0.09
http://search.cpan.org/~fayland/Lingua-Han-Utils-0.09/
The utility tools of Chinese character(HanZi) 
----
MP4-File-0.01
http://search.cpan.org/~mhx/MP4-File-0.01/
Read/Write MP4 files 
----
Mail-DKIM-0.30_9
http://search.cpan.org/~jaslong/Mail-DKIM-0.30_9/
Signs/verifies Internet mail with DKIM/DomainKey signatures 
----
Module-Build-IkiWiki-0.0.6
http://search.cpan.org/~vmoral/Module-Build-IkiWiki-0.0.6/
Extension for develop Ikiwiki plugins 
----
Module-Faker-0.006
http://search.cpan.org/~rjbs/Module-Faker-0.006/
build fake dists for testing CPAN tools 
----
Muldis-D-0.25.0
http://search.cpan.org/~duncand/Muldis-D-0.25.0/
Formal spec of Muldis D relational DBMS lang 
----
Net-DownloadMirror-0.08
http://search.cpan.org/~knorr/Net-DownloadMirror-0.08/
Perl extension for mirroring a remote location via FTP to the local directory 
----
Net-Google-Calendar-0.93
http://search.cpan.org/~simonw/Net-Google-Calendar-0.93/
programmatic access to Google's Calendar API 
----
Net-MirrorDir-0.18
http://search.cpan.org/~knorr/Net-MirrorDir-0.18/
Perl extension for compare local-directories and remote-directories with each other 
----
Net-OBEX-Response-0.003
http://search.cpan.org/~zoffix/Net-OBEX-Response-0.003/
interpret OBEX protocol response packets 
----
Net-SNMP-Mixin-0.01_02
http://search.cpan.org/~gaissmai/Net-SNMP-Mixin-0.01_02/
mixin framework for Net::SNMP 
----
Net-SNMP-Mixin-0.02
http://search.cpan.org/~gaissmai/Net-SNMP-Mixin-0.02/
mixin framework for Net::SNMP 
----
Net-Telnet-Netscreen-1.2
http://search.cpan.org/~mramberg/Net-Telnet-Netscreen-1.2/
interact with a Netscreen firewall 
----
Net-UCP-0.33
http://search.cpan.org/~nemux/Net-UCP-0.33/
Perl extension for EMI - UCP Protocol. 
----
Net-UCP-0.34
http://search.cpan.org/~nemux/Net-UCP-0.34/
Perl extension for EMI - UCP Protocol. 
----
Net-UCP-Common-0.01
http://search.cpan.org/~nemux/Net-UCP-Common-0.01/
Common Stuff for Net::UCP Module 
----
Net-UCP-IntTimeout-0.02
http://search.cpan.org/~nemux/Net-UCP-IntTimeout-0.02/
Perl 
----
Net-UCP-TransactionManager-0.01
http://search.cpan.org/~nemux/Net-UCP-TransactionManager-0.01/
Perl extension to manage UCP session transaction numbers 
----
Net-UploadMirror-0.11
http://search.cpan.org/~knorr/Net-UploadMirror-0.11/
Perl extension for mirroring a local directory via FTP to the remote location 
----
POE-Component-CPAN-LinksToDocs-No404s-Remember-0.002
http://search.cpan.org/~zoffix/POE-Component-CPAN-LinksToDocs-No404s-Remember-0.002/
non-blocking wrapper around CPAN::LinksToDocs::No404s::Remember module 
----
POE-Component-IRC-Plugin-BaseWrap-0.005
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-BaseWrap-0.005/
base class for IRC plugins which need triggers/ban/root control 
----
POE-Component-IRC-Plugin-CSS-PropertyInfo-0.002
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-CSS-PropertyInfo-0.002/
lookup CSS property information from IRC 
----
POE-Component-IRC-Plugin-HTML-AttributeInfo-0.002
http://search.cpan.org/~zoffix/POE-Component-IRC-Plugin-HTML-AttributeInfo-0.002/
HTML attribute info lookup from IRC 
----
POE-Component-Server-NRPE-0.08
http://search.cpan.org/~bingos/POE-Component-Server-NRPE-0.08/
A POE Component implementation of NRPE Daemon. 
----
POE-Component-Server-NSCA-0.04
http://search.cpan.org/~bingos/POE-Component-Server-NSCA-0.04/
a POE Component that implements NSCA daemon functionality 
----
POE-Component-Server-POP3-0.04
http://search.cpan.org/~bingos/POE-Component-Server-POP3-0.04/
A POE framework for authoring POP3 servers 
----
POE-Component-WakeOnLAN-0.02
http://search.cpan.org/~bingos/POE-Component-WakeOnLAN-0.02/
A POE Component to send packets to power on computers. 
----
Parallel-Prefork-0.02
http://search.cpan.org/~kazuho/Parallel-Prefork-0.02/
A simple prefork server framework 
----
Parse-Marpa-0.207_001
http://search.cpan.org/~jkegl/Parse-Marpa-0.207_001/
(Alpha) Earley's algorithm with LR(0) precomputation 
----
Parse-Marpa-0.207_002
http://search.cpan.org/~jkegl/Parse-Marpa-0.207_002/
(Alpha) Earley's algorithm with LR(0) precomputation 
----
SVG-2.39
http://search.cpan.org/~ronan/SVG-2.39/
Perl extension for generating Scalable Vector Graphics (SVG) documents 
----
SVG-Template-Graph-0.14
http://search.cpan.org/~ronan/SVG-Template-Graph-0.14/
Perl extension for generating template-driven graphs with SVG 
----
Sys-Statistics-Linux-0.34
http://search.cpan.org/~bloonix/Sys-Statistics-Linux-0.34/
Front-end module to collect system statistics 
----
Template-Direct-1.16
http://search.cpan.org/~doctormo/Template-Direct-1.16/
Creates a document page based on template/datasets 
----
Test-DBIx-Class-Schema-0.01004
http://search.cpan.org/~chisel/Test-DBIx-Class-Schema-0.01004/
DBIx::Class schema sanity checking tests 
----
Test-Simple-0.80
http://search.cpan.org/~mschwern/Test-Simple-0.80/
Basic utilities for writing tests. 
----
Time-HiRes-1.9715
http://search.cpan.org/~jhi/Time-HiRes-1.9715/
High resolution alarm, sleep, gettimeofday, interval timers 
----
WWW-FreeProxy-0.02
http://search.cpan.org/~swined/WWW-FreeProxy-0.02/
fetch proxies from free proxy lists 
----
WWW-IndexParser-0.9
http://search.cpan.org/~jeb/WWW-IndexParser-0.9/
Fetch and parse the directory index from a web server 
----
WWW-Pastebin-CSSStandardsOrg-Retrieve-0.002
http://search.cpan.org/~zoffix/WWW-Pastebin-CSSStandardsOrg-Retrieve-0.002/
retrieve pastes from http://paste.css-standards.org/ pastebin 
----
WWW-Pastebin-PastebinCa-Retrieve-0.002
http://search.cpan.org/~zoffix/WWW-Pastebin-PastebinCa-Retrieve-0.002/
a module to retrieve pastes from http://pastebin.ca/ website 
----
WebService-Lucene-0.08
http://search.cpan.org/~bricas/WebService-Lucene-0.08/
Module to interface with the Lucene indexing webservice 
----
Win32-WindowsMedia-0.20
http://search.cpan.org/~shamrock/Win32-WindowsMedia-0.20/
Base Module for Provisiong and control for Windows Media Services 
----
Workflow-0.32_1
http://search.cpan.org/~jonasbn/Workflow-0.32_1/
Simple, flexible system to implement workflows 
----
XML-Compile-0.73
http://search.cpan.org/~markov/XML-Compile-0.73/
Compilation based XML processing 
----
XML-Compile-SOAP-0.69
http://search.cpan.org/~markov/XML-Compile-SOAP-0.69/
base-class for SOAP implementations 
----
XML-Compile-SOAP-Daemon-0.10
http://search.cpan.org/~markov/XML-Compile-SOAP-Daemon-0.10/
base class for SOAP message servers 
----
XML-Easy-0.000
http://search.cpan.org/~zefram/XML-Easy-0.000/
XML processing with a clean interface 
----
kurila-1.9_0
http://search.cpan.org/~tty/kurila-1.9_0/
Perl Kurila 
----
libwww-perl-5.810
http://search.cpan.org/~gaas/libwww-perl-5.810/
----
setenv-0.03
http://search.cpan.org/~elizabeth/setenv-0.03/
conveniently (re)set %ENV variables at compile time 


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: Tue, 8 Apr 2008 23:44:29 -0700 (PDT)
From: Yogi <yogeshkagrawal@gmail.com>
Subject: Perl Regex substitution: replace nth occurrance
Message-Id: <deb1dc09-7eed-415d-9f6b-24506bca5d2d@x41g2000hsb.googlegroups.com>

Hi Guys,
I have a variable say:
$x = "this is test program with test inputs";

My requirement is to replace nth occurrance of "test" with something
else.  how to achieve the same using perl regex. if i do something
like:
$x =~ s/test/java/g;

This is going to replace all occurrance of test with "java" but my
requirement is to replace say 2nd occurrance only.  Any help?

Regards.


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

Date: Wed, 09 Apr 2008 09:05:07 +0200
From: Frank Seitz <devnull4711@web.de>
Subject: Re: Perl Regex substitution: replace nth occurrance
Message-Id: <663855F2i6uj8U4@mid.individual.net>

Yogi wrote:
> I have a variable say:
> $x = "this is test program with test inputs";
> 
> My requirement is to replace nth occurrance of "test" with something
> else.  how to achieve the same using perl regex. if i do something
> like:
> $x =~ s/test/java/g;
> 
> This is going to replace all occurrance of test with "java" but my
> requirement is to replace say 2nd occurrance only.  Any help?

perldoc -q nth

Frank
-- 
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel


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

Date: Tue, 8 Apr 2008 19:09:28 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: perl should be improved and perl6
Message-Id: <slrnfvo29o.8p0.tadmc@tadmc30.sbcglobal.net>

Gordon Etly <get@bentsys.com> wrote:
> David Formosa (aka ? the Platypus) wrote:
>> On Mon, 7 Apr 2008 15:42:57 -0700, szr <szrRE@szromanMO.comVE> wrote:
>> > David Formosa (aka ? the Platypus) wrote:
>> [...]
>> > > So emacs is an acronym for Eight Megs And Constantly Swapping.
>> >
>> > No, the man page for "emacs" defines it as "emacs - GNU project
>> > Emacs", while for perl (either via man or perldoc) defines it as
>> > "perl - Practical Extraction and Report Language".
>>
>> But neather of those are definitions, there abstracts.
>
> That may be, and perhaps definition was too strong a wording to describe 
> it, but it's still written as providing some sort of meaning for each 
> letter in Perl, in Perl's own documentation.
>
> Giving a meaning for each letter results in an acronym, and using all 
> caps or all lowercase to describe an acronym that has no explicit mixed 
> case should be fair game, should it not?
>
> There for


That was unfortunate...


>  the FAQ that says not to use "PERL" should be corrected imho, 


It could be corrected from:

   But never write "PERL", because perl is not an acronym,
   apocryphal folklore and post-facto expansions notwithstanding.

to something like:

   But never write "PERL", because perl is not an acronym,
   and you will look silly if you spell it like that.


> as it is perfectly reasonable to use it as "perl" or "PERL" when 
> referring to it as an acronym.


Whether it is right or wrong, documented or not does not matter
much with regard to whether to write "PERL" or not.

Why do people apply a stigma to those who use it?

From their *observed experience*.

There is a strong correlation between spelling it that way and
being a post that I would rather skip reading.

Q: Is that right?
A: Doesn't matter, because the heuristic *works* whether right or wrong.




So, how can we make it OK to spell it PERL?

Simply change the observed experience so that it is no longer effective.

ie. impart clue by pointing out that it is not spelled "PERL".

When "PERL" and "I want to skip this one" are no longer related,
then people will stop depending on the information that those
rules of thumb currently provide to us.


-- 
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"


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

Date: Tue, 8 Apr 2008 20:50:49 -0700
From: "Gordon Etly" <get@bentsys.com>
Subject: Re: perl should be improved and perl6
Message-Id: <662sorF2i6k5fU1@mid.individual.net>

Tad J McClellan wrote:
> Gordon Etly <get@bentsys.com> wrote:

>> as it is perfectly reasonable to use it as "perl" or "PERL" when
>> referring to it as an acronym.
>
> Whether it is right or wrong, documented or not does not matter
> much with regard to whether to write "PERL" or not.

How can it suddenly not matter what the documentation that coems with 
Perl says?!? I says

How does giving "Practical Extraction and Report Language" as a 
definition for "perl" not an acronym, and how does that not make using 
PERL perfectly acceptable?

It appears to me that most of you who are so bent against the usage of 
"PERL" are missing or just plain ignoring 'perldoc perl' and looking for 
any excuse, any technicality, anything at all it seems in effort to 
refute the claims, all of which are contrary to what Perl's own 
documentation.

Is it that you don't like being challenged about something you hold so 
dear and just cannot accept that there may be another perspective to it? 
Are you so inflexible you cannot even acknowledge the validity of this 
view? It wont kill ya' to look at a different point of view, ya' know :)

I full-heartedly believe that that FAQ is contradicted by 'perldoc perl' 
and that it should be corrected.

-- 
G.Etly 




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

Date: Tue, 8 Apr 2008 21:38:27 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: perl should be improved and perl6
Message-Id: <4rttc5x01j.ln2@goaway.wombat.san-francisco.ca.us>

On 2008-04-09, Gordon Etly <get@bentsys.com> wrote:
>
> I full-heartedly believe that that FAQ is contradicted by 'perldoc perl' 
> and that it should be corrected.

If you believe this, compose a patch and submit it to the FAQ maintainer.

Personally, I don't write PERL just because it looks stupid, but I don't
care what other people write, as long as they don't post something like

"Why doesn't this work?

% PERL myperl.pl
-bash: PERL: command not found

Help!"

OTOH, I find it difficult to support your claim that perldoc perl
contradicts the FAQ, especially since perldoc perl calls it "Perl"
throughout.

--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: Tue, 8 Apr 2008 23:28:59 -0700
From: "Gordon Etly" <get@bentsys.com>
Subject: Re: perl should be improved and perl6
Message-Id: <66361eF2ja07cU1@mid.individual.net>

Keith Keller wrote:
> On 2008-04-09, Gordon Etly <get@bentsys.com> wrote:
>>
>> I full-heartedly believe that that FAQ is contradicted by 'perldoc
>> perl' and that it should be corrected.
>
> If you believe this, compose a patch and submit it to the FAQ
> maintainer.

I will consider doing that. Thank you.

> Personally, I don't write PERL just because it looks stupid,

What makes it so stupid? perldoc gives a meaning for each letter in 
"perl", and "PERL" is just another way to write that.


  $ perldoc perl | head -6 | tail -2

  NAME
         perl - Practical Extraction and Report Language



And this meaning is widely known (here is just one of about a dozen 
different acronym sites:)

acronymfinder.com/acronym.aspx?rec={9929633B-89E8-11D4-8351-00C04FC2C2BF}

  What does PERL stand for?

  Practical Extraction and Report Language


> but I don't care what other people write, as long as they don't
> post something like
>
> "Why doesn't this work?
>
> % PERL myperl.pl
> -bash: PERL: command not found
> Help!"

This is not what is being discussed. This is incorrectly typing the name 
of a program in your search path. It's no different than if one typed 
BASH instead of bash or LS instead of ls. <[1]>

What //is// being discussed is that the use of "PERL" in general instead 
of it always being shot down. Seeing as the official documentation 
states a meaning for each latter, it should be fair game to use "perl" 
or "PERL" as an acronym, and anyone who reads 'perldoc perl'/'man perl'.

At the very least those saying one who uses "PERL" to refer to the 
language displays ignorance could be very wrong, as one who uses it to 
refer to the language could just be following what they've read on the 
first page of the documentation.


> OTOH, I find it difficult to support your claim that perldoc perl
> contradicts the FAQ, especially since perldoc perl calls it "Perl"
> throughout.

It may use Perl throhhgout, but again, at the very beginning:

  $ perldoc perl | head -6 | tail -2

  NAME
         perl - Practical Extraction and Report Language


The NAME line uses "perl" and gives //a// meaning for each letter, each 
one capitalized. This alone should make using "PERL" perfectly valid. 
Yes, it has been tradition //not// to use "PERL" but just because 
something is tradition doesn't mean it's infallible and that it can't be 
looked at in another way. That is all I'm trying to do here.


<[1]> That specific example uses bash (and implies some sort of UNIX 
based environment), though systems where case does not matter, such as 
on Windows and MS-DOS, "PERL myperl.pl" works just fine. Even under bash 
via cygwin.

The filename of the Perl binary itself is lowercase in such systems, 
though in some file systems where everything is always uppercase (like 
in pure MS-DOS), then the binary would be PERL. This is also true for 
CD's burned in certain formats.


-- 
G.Etly 




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

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


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