[7750] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1375 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Nov 27 11:08:10 1997

Date: Thu, 27 Nov 97 08:00:27 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 27 Nov 1997     Volume: 8 Number: 1375

Today's topics:
     Backquote in Perl venkat5@hotmail.com
     CGI.pm cannot be autoloaded <peter.mutsaers@mail.ing.nl>
     Re: CGI.pm cannot be autoloaded <zenin@best.com>
     Contract Programmers Needed! <markmangum@ibm.net>
     Re: Decimal rounding and lining up decimals? (William R. Ward)
     DLL problem <eensteen@elektron.et.tudelft.nl>
     Re: Embarrassing Perl Code (was PERL Hourly Rates) (Iain Chalmers)
     Re: hopefully not giving up on flock <dformosa@st.nepean.uws.edu.au>
     How to change $) (Marek Rouchal)
     Re: is it possible to reference a sub-array? <zenin@best.com>
     last element in an array? , snailgem@aol.com
     Net::FTP docs ? <alex@online.emap.com>
     Re: nt build of perl5.004_04 <mchase@ix.netcom.com>
     OS/2: s/// statement still crashing <koos_pol@bigfoot.com>
     Re: Perl - Date Compare (Ronald L. Parker)
     Re: perl bad for backgroud job? twod@not.valid
     Re: PERL Hourly Rates (Iain Chalmers)
     Re: PERL Hourly Rates (brian d foy)
     Re: PERL Hourly Rates <zenin@best.com>
     Re: PERL Hourly Rates (Toutatis)
     Re: print "Location: http://www.my_html.html\n\n";      <robert.friberg@your_clothes.eductus-vast.com>
     Re: Regex for three equal characters <dformosa@st.nepean.uws.edu.au>
     Re: Regex for three equal characters (brian d foy)
     Re: Removing Files older than 14 days <jamesr@aethos.co.uk.nospam>
     send mail using perl5 (Thana Letchumi)
     Silly diamond operator (<>) problem? <mcdermidg@acm.org>
     Re: sum in assoc array (Terry Michael Fletcher - PCD ~)
     Re: System runs as sub-process... <zenin@best.com>
     Text Matching <nyc-guy@ix.netcom.com>
     Re: Text Matching (brian d foy)
     use of chdir in backquote venkat5@hotmail.com
     Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

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

Date: Wed, 26 Nov 1997 00:03:02 -0600
From: venkat5@hotmail.com
To: venkat5@hotmail.com
Subject: Backquote in Perl
Message-Id: <880523064.10150@dejanews.com>
Keywords: unable to use of cd in backquote

could someone help in ,how to use cd(change directory) within backquotes.
print `cd \dir1`; is not working. other  commands like dir are working.
i am using Perl 5.001 under WinNT 4.0
Thanx.

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 26 Nov 1997 09:58:04 +0100
From: Peter Mutsaers <peter.mutsaers@mail.ing.nl>
Subject: CGI.pm cannot be autoloaded
Message-Id: <ueoh38m3qb.fsf@news.ing.nl>

Hello,

Looking into the (large) CGI.pm module it looks like it is intended to
be autoloadable. But it cannot. If I try to autosplit it manually, it
isn't split at all.

Does anyone know why this is?

Thanks,
-- 
Peter Mutsaers, ING group, dept. ITC/N+C           |         "Trust me,
peter.mutsaers@mail.ing.nl or plm@xs4all.nl (home) |  I know what I'm doing"
---------------------------------------------------+------------------------
FreeBSD: turning PC's into workstations. See http://www.freebsd.org


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

Date: 26 Nov 1997 10:33:03 GMT
From: Zenin <zenin@best.com>
Subject: Re: CGI.pm cannot be autoloaded
Message-Id: <880540565.141174@thrush.omix.com>

[ posted & mailed ]

Peter Mutsaers <peter.mutsaers@mail.ing.nl> wrote:
: Looking into the (large) CGI.pm module it looks like it is intended to
: be autoloadable. But it cannot. If I try to autosplit it manually, it
: isn't split at all.
: Does anyone know why this is?

	It's already autoloaded, in part anyway.  He's using a rather funky
	form of autoloading (take a look at the AUTOLOAD() handler code).

	The common and required methods and functions are provided static.
	The rest is autoloaded.  Take a deeper look at the %SUBS hash.

	It can't be split, not easily at least and you'd gain little as the
	important stuff is already autoloaded.

-- 
-Zenin
 zenin@best.com


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

Date: Tue, 25 Nov 1997 20:15:33 -0800
From: MARK MANGUM <markmangum@ibm.net>
Subject: Contract Programmers Needed!
Message-Id: <347BA265.7E55F6CF@ibm.net>

Web Blueprints is launching a national advertising campaign to sell web
design services.  We need 150 skilled programmers and graphic artists to
work on a contract basis.  Our sales people will sell the job, write up
all the specification, and forward these to you for a bid.  Successful
bidders will be awarded the contract.  If you would be interested in
participating in this project and bidding on individual jobs, please
email your resume to:

markmangum@ibm.net

Please include URL's of web pages you have designed.




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

Date: 26 Nov 1997 00:52:57 -0800
From: hermit@cats.ucsc.edu (William R. Ward)
Subject: Re: Decimal rounding and lining up decimals?
Message-Id: <waawwhwvxxy.fsf@am.UCSC.EDU>

jhughes@iastate.edu (Jeff Hughes) writes:
>     I'm working with dollar amounts, which sometimes get multiplied and
> result in something like  45.375   Other than breaking it apart and putting
> it back together as a string, what's the quickest way to turn it into 45.38?
> I have something right now, but it just looks/seems too slow.
> 
>     Also the Camel book mentions output formatting using # and . for lining
> up numerical values but doesn't give any suggestions.  Nothing I've tried
> seems to work.

The Number::Format package that I'm just about to release to CPAN
(e-mail me if you want to betatest it) should meet your needs, and
then some.  Here's the manpage for it:

NAME
    Number::Format - Perl extension for formatting numbers

SYNOPSIS
      use Number::Format;
      
      $rounded = round($number, $precision);
      $formatted = format_number($number, $precision);
      $formatted = format_picture($number, $picture);
      $formatted = format_price($number, $currency, $precision);
      $number = unformat_number($formatted);


REQUIRES
    Perl, version 5.003 or higher.

DESCRIPTION
    These functions provide an easy means of formatting numbers in a
    manner suitable for displaying to the user.

    The output formats by default use the comma character (,) to
    separate every three digits to the left of the decimal point and
    a period (.) as the decimal point. However by modifying the
    package global variables `$DECIMAL_SEP' and `$THOUSANDS_SEP' you
    can set these to any characters you wish. The only restrictions
    are that they must not be digits, must not be identical, and
    must each be one character.

    A third package global variable `$CURRENCY' is used as the
    default currency by `format_price' (see below) and can be reset
    by the user to the local currency prefix string.

    For example, a German user might include this in their code:

      use Number::Format;
      $Number::Format::THOUSANDS_SEP = '.';
      $Number::Format::DECIMAL_SEP   = ',';
      $Number::Format::CURRENCY      = 'DM';


EXPORTS
    All functions described herein are automatically exported.

FUNCTIONS
    round($number, $precision)
        Rounds the number to the specified precision. If
        `$precision' is omitted, the default value of 2 is used.
        Both input and output are numeric (the function uses math
        operators rather than string manipulation to do its job),
        The value of `$precision' may be any integer, positive or
        negative. Examples:

          round(3.14159)       yields    3.14
          round(3.14159, 4)    yields    3.1416
          round(42.00, 4)      yields    42
          round(1234, -2)      yields    1200


        Since this is a mathematical rather than string oriented
        function, there will be no trailing zeroes to the right of
        the decimal point, and the `$DECIMAL_SEP' and
        `$THOUSANDS_SEP' variables are ignored. To format your
        number using the `$DECIMAL_SEP' and `$THOUSANDS_SEP'
        variables, use `format_number()' instead.

    format_number($number, $precision)
        Formats a number by adding `$THOUSANDS_SEP' between each set
        of 3 digits to the left of the decimal point, substituting
        `$DECIMAL_SEP' for the decimal point, and rounding to the
        specified precision using `round()'. Note that `$precision'
        is a *maximum* precision specifier; trailing zeroes will not
        appear in the output (see `format_price()' for that). If
        `$precision' is omitted, the default value of 2 is used.
        Examples:

          format_number(12345.6789)      yields   '12,345.68'
          format_number(123456.789, 2)   yields   '123,456.79'
          format_number(1234567.89, 2)   yields   '1,234,567.89'
          format_number(1234567.8, 2)    yields   '1,234,567.8'
          format_number(1.23456789, 6)   yields   '1.234568'


        Of course the output would have your values of
        `$THOUSANDS_SEP' and `$DECIMAL_SEP' instead of ',' and '.'
        respectively.

    format_picture($number, $picture)
        Returns a string based on `$picture' with the `#' characters
        replaced by digits from `$number'. If the length of the
        integer part of $number is too large to fit, the `#'
        characters are replaced with asterisks (`*') instead.
        Examples:

          format_picture(1000.23, 'US$##,###.##')   yields   'US$ 1,000.23'
          format_picture(10002.3, 'US$##,###.##')   yields   'US$10,002.30'
          format_picture(100023,  'US$##,###.##')   yields   'US$**,***.**'
          format_picture(1.00023, 'US$#.###,###')   yields   'US$1.002,300'


        The comma (,) and period (.) you see in the picture examples
        should match the values of `$THOUSANDS_SEP' and
        `$DECIMAL_SEP', respectively, for proper operation.

    format_price($number, $currency, $precision)
        Returns a string containing `$number' formatted similarly to
        `format_number()', except that the decimal portion may have
        trailing zeroes added to make it be exactly `$precision'
        characters long, and the value of `$currency' will be
        prefixed.

        If `$currency' is not provided, the package global
        `$CURRENCY' will be used, which has the value `US$' by
        default (To omit the currency, specify an empty string for
        `$currency'). If `$precision' is not provided, the default
        of 2 will be used. Examples:

          format_price(12.95)       yields   'US$12.95'
          format_price(12)          yields   'US$12.00'
          format_price(12, '', 3)   yields   '12.000'


    unformat_number($formatted)
        Converts a string as returned by `format_number()',
        `format_price()', or `format_picture()', and returns the
        corresponding value as a numeric scalar. Returns `undef' if
        the number doesn't contain any digits. Examples:

          unformat_number('US$12.95')   yields   12.95
          unformat_number('US$12.00')   yields   12
          unformat_number('foobar')     yields   <undef>


AUTHOR
    William R. Ward, wrw@bayview.com

SEE ALSO
    perl(1).


-- 
William R Ward          Bay View Consulting   http://www.bayview.com/~hermit/
hermit@bayview.com     1803 Mission St. #339        voicemail +1 408/479-4072
hermit@cats.ucsc.edu  Santa Cruz CA 95060 USA           pager +1 408/458-8862


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

Date: Wed, 26 Nov 1997 12:15:20 +0100
From: "J. Frenk alias Sigmund Freud" <eensteen@elektron.et.tudelft.nl>
Subject: DLL problem
Message-Id: <347C04C8.43EA@elektron.et.tudelft.nl>

Hello all,

I have the following problem. I have installed the perl library on a
NT4.0 system, and after that, i installed the PerlIS.dll. That all went
ok, I wrote a cgi-script that should work, but i get the folliwing error
msg:

HTTP/1.0 500 Server Error (A dynamic link library (DLL)
initialization routine failed. ) 

Can anyone please help me?
Thanks in advance,

Jaron Frenk

-- 
*****Just one year of love, is better than a life time alone...*****


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

Date: Wed, 26 Nov 1997 14:30:23 +1100
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: Embarrassing Perl Code (was PERL Hourly Rates)
Message-Id: <bigiain-ya02408000R2611971430230001@news.ozemail.com.au>

In article <65fuqk$drr@mtinsc03.worldnet.att.net>, comdog@computerdog.com
(brian d foy) wrote:

> In article <8c4t50eick.fsf@gadget.cscaper.com>, Randal Schwartz
> <merlyn@stonehenge.com> wrote:
> 
> > >>>>> "twod" == twod  <twod@not.valid> writes:
> > 
> > twod> Is it not one of the unwritten rules about
> > twod> contracting/consulting that you reserve the right to throw your
> > twod> hands in the air and exclaim 'Who the hell wrote this junk and
> > twod> why ? when maintaining code ?
> > 
> > twod> Believe me, someone will have said this about some of your code
> > twod> in the past if you have been in the industry for a while - I'm
> > twod> sure it's been said of some of my early work :)
> > 
> > I've said it about my *own* stuff when I've gone back later.
> > Admittely, modern versions of Perl really make a lot of things easier
> > that we had to do "by hand" earlier.
> 
> i'm always saying it of my own stuff :)
> 
> the scary part is when i say it the day after i wrote it.

you mean, its not just me who writes *FANTASTIC* code at 3:30am, only to
find it doesn't even compile the next morning???

iain

Iain Chalmers
bigiain@mightymedia.com.au


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

Date: 26 Nov 1997 03:01:01 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: hopefully not giving up on flock
Message-Id: <880513174.768184@cabal>

In <65cr53$9hd@world6.bellatlantic.net> "Dave Kaufman" <davidk@nospam.cnct.com> writes:

>My question, since flock is (was originally) BSD-ish specific, am I going to
>have problems with my next client, who is on linux? Or is linux up to speed
>flockwise?

flock is present on my linix box and I would assume that it is standard
accross most versons.




--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. I do not reply to mungged 
Support NoCeM http://www.cm.org/                   addresses.  
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: 26 Nov 1997 10:32:31 +0100
From: Marek.Rouchal@-nospam-hl.siemens.de (Marek Rouchal)
Subject: How to change $)
Message-Id: <65gqbf$m91@buffalo.HL.Siemens.DE>
Keywords: primary secondary groups $( $)

In the perl5.00404 perldelta manual I've read:

> Group vector changeable with $)
>
> The $) special variable has always (well, in Perl 5, at least) reflected
> not only the current effective group, but also the group list as
> returned by the getgroups() C function (if there is one). However, until
> this release, there has not been a way to call the setgroups() C
> function from Perl.
>
> In Perl 5.004, assigning to $) is exactly symmetrical with examining it:
> The first number in its string value is used as the effective gid; if
> there are any numbers after the first one, they are passed to the
> setgroups() C function (if there is one).

Now I've tried the following code:

#!/usr/local/bin/perl -w

print "Perl: $]\nGID: $(\nEGID: $)\n";

unlink("GID1.txt","GID2.txt");

open(FILE, ">GID1.txt") or die "$!";
print FILE "test\n";
close(FILE);

$) = 10051; # one of my secondary groups
$( = 10051;

print "newGID: $(\nnewEGID: $)\n";

open(FILE, ">GID2.txt") or die "$!";
print FILE "test\n";
close(FILE);

The output is:

Perl: 5.00404
GID: 11100 19002 51107 10051 11100
EGID: 11100 19002 51107 10051 11100
newGID: 11100 19002 51107 10051 11100
newEGID: 11100 19002 51107 10051 11100

The files created belong both to my primary group.

Can anybody please tell me what I'm missing? Thank you!
(using a SunOS 5.5.1 Generic sun4u sparc SUNW,Ultra-1).

Regards,

Marek

PS. If you want to reply by Email, please remove -nospam- from
    the address. Thank you.

-- 
  Marek Rouchal                   Phone : +49 89/636-25849
     SIEMENS AG, HL CAD SYS       Fax   : +49 89/636-23650
     Balanstr. 73                 mailto:Marek.Rouchal@-nospam-hl.siemens.de
     81541 Muenchen               PCmail:Marek.Rouchal.PC@-nospam-hl.siemens.de


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

Date: 26 Nov 1997 08:38:53 GMT
From: Zenin <zenin@best.com>
Subject: Re: is it possible to reference a sub-array?
Message-Id: <880533720.251016@thrush.omix.com>

[ posted & mailed ]

Mark Mielke <markm@nortel.ca> wrote:
	>snip<
: rephrase: perl doesn't claim to be able to do what i _want_ to do... :-)
:           i'd like to pass a array splice around by reference. the same
:           goes for passwing a string substr() around. It's partially done...
:                substr($_, 0, 2) = "ab";
:           but you can't keep the substr() properly in another variable w/o
:           copying it :-(

	Actually, it seems you can although it's not documented and to quote
	Larry's response to Tom++, "I suspect it's fragile.", this is a
	little code snip that Tom recently sent to p5p:

		$a = "fred";
		*b = \substr($a, 1, 1);
		$b = "razzl";
		print $a;

		# frazzled

	As all things in software design go, I'd *HIGHLY* suggest taking
	heed of the phrase, "If it isn't documented, it doesn't exist".
	Since it's not documented, it doesn't have to be in the next
	release.

	I would, however like to see this extended to include splice(). eg,
	I'd like to be able to do:
		@a = qw(fred barney);
		*b = \splice (@a, 1, 1);
		@b = qw(dog);
		print "@a";

		# Should print "fred dog"

	Alas, this doesn't work (yet).

	You could however, make a tied class that could do similar magic.

-- 
-Zenin
 zenin@best.com


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

Date: Tue, 25 Nov 1997 22:38:41 -0500
From: , snailgem@aol.com
Subject: last element in an array?
Message-Id: <347B99C0.6013@aol.com>

Here's the question.
I have a file such as:

[some stuff here]
line_1=some stuff here
line_2=different stuff here
 .
 .
line_n=always different stuff here
[some more stuff here]


I need to insert a line into this file, so it will look like:

[some stuff here]
line_1=some stuff here
 .
 .
line_n=always different stuff here
line_n+1=stuff that I pass as command line args here
[some more stuff here]

I basically use grep to find all the lines that have the pattern
/line\d_/
(I need to count the lines too and do some other stuff). Then I thought
of tacking on the new line by substituting 
line_n=always different stuff here
with 
line_n=always different stuff here
line_n+1=stuff that I pass as command line args here

In order to do this, I need to be able to reference the last element of
the array returned by grep. How do I do this?
I.E., if
@matches=grep (/line\d_/, @myfile);
and
$nu_matches=grep (/line\d_/, @myfile);
how do I reference the last element of @matches? ($matches[$nu_matches]
doesn't work).

Or am I going the wrong way about all this?

Thanks.


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

Date: Wed, 26 Nov 1997 06:11:34 -0600
From: Alex Schajer <alex@online.emap.com>
Subject: Net::FTP docs ?
Message-Id: <880545874.23379@dejanews.com>

Hi,

Does anybody know where I can get some documentation for net::FTP

or better still could you tell me how to check a Transfer has got to
it's destination?

Thanks

Alex

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: Tue, 25 Nov 1997 21:20:23 -0800
From: "Michael A. Chase" <mchase@ix.netcom.com>
Subject: Re: nt build of perl5.004_04
Message-Id: <65h32g$6p4@dfw-ixnews11.ix.netcom.com>

Perl also builds fine with Borland C++ 5.02 if you use dmake instead of
Borland's make. Compiled copies of dmake and patch.exe are available at
http://www-personal.umich.edu/~gsar.

--
Mac :})   mchase@ix.netcom.com


Danny Aldham wrote in message <65d67o$t4i$1@lennon.postino.com>...
>Thomas Lockney (tlockney@tivoli.nospam) wrote:
>: Danny Aldham wrote:
>: > Perl builds fine with Microsoft's Visual C++ 5. Use that if you can.
>: > If you use Cygnus's kit, there are patches to be applied, but first
>: > you must patch the patch program. No kidding.
>
>:   Patch the patch, eh? I noticed that it fails but am not sure how to
patch
>: it. Any thoughts?
>
>You can get a new copy of the latest patch program via ftp at
>prep.ai.mit.edu .





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

Date: Wed, 26 Nov 1997 11:26:18 +0100
From: Koos Pol <koos_pol@bigfoot.com>
Subject: OS/2: s/// statement still crashing
Message-Id: <347BF94A.5B9E@bigfoot.com>

$string  = 'a' x 1000;
 $search  = 'b' x 1000;
 $replace = 'c' x 1000;
 $string  =~ s/$search/$replace/;

This script still crashes and dumps core. I used the default directories
suggested by the installer. 

Config info:
 * Warp 4.0 + FP4
 * Perl 5.004_01
 * binaries from Ilya Z.
 * TVFS for linking the default dir's.
 * EMX fix04
 * a clean install, removed all traces from the prev. install

So the use of TVFS for the default dirs did not help. Can someone offer
a last suggestion before I try to build the port myself ?

-- 
Koos Pol
----------------------------------------------------------------------
S.C. Pol                                           tel: +31 20 3116122
PC Systems Administrator                   email: Koos_Pol@bigfoot.com
Compuware Europe                 PGP public key available upon request

      A little inaccuracy sometimes saves tons of explanation.
                        -- H. H. Munroe


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

Date: Tue, 25 Nov 1997 18:45:26 GMT
From: ron@farmworks.com (Ronald L. Parker)
Subject: Re: Perl - Date Compare
Message-Id: <347b1b82.20203420@10.0.2.33>

>    @sorted_dates = sort by_date @dates;
>    sub by_date {
>	$b->kissing	 <=> $a->kissing	or
>	$b->cuddliness	 <=> $a->cuddliness	or
>	$b->cuteness	 <=> $a->cuteness	or
>	$a->neediness	 <=> $b->neediness	or
>	$b->intelligence <=> $a->intelligence	or
>	$a cmp $b
>    }

You really rank your dates' intelligence so low that only their
addresses are less important?  I should have thought that intelligence
would be the first term in the comparison.



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

Date: 26 Nov 1997 04:42:47 GMT
From: twod@not.valid
Subject: Re: perl bad for backgroud job?
Message-Id: <65g9c7$734$2@vnetnews.value.net>

Mark Evans (maevans@io.com) wrote:
: Memory Allocation is really a 'ignore it' in perl. What is important,
: however, is to make sure you're not calling subroutines which never end
: (i.e. a recursive routine gone bad). Memory is release when it is no longer
: referenced. Watch for anonymous references and the like. Perl is probably
: just as good as any for your task. Probably the same memory allocation
: issues too!

That's generally true, but there are caveats:-

Perl 5.004_04 is a new maintenance release of Perl. This release fixes a
major memory bug and it provides enhanced portability for the Win32 platform. 

PERL, like any language, is largely forced to abide by the memory management
facilities/features/bugs of the OS' that it uses. The garbage collection
facilities of PERL can only free memory such that the same process can 
reuse it. This means that a long running deamon will be sized at the 
maximum size of it's data storage, which is why a number of people make
sure that deamon processes restart themselves at regular intervals to ensure
memory hogging is minimised.

PERL gives you choice of mallocs, this may or may not be a problem :)

IAP
--
I am using anti-spam measures, please replace 'not.valid' with 'value.net'


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

Date: Wed, 26 Nov 1997 14:26:55 +1100
From: bigiain@mightymedia.com.au (Iain Chalmers)
Subject: Re: PERL Hourly Rates
Message-Id: <bigiain-ya02408000R2611971426550001@news.ozemail.com.au>

<-snip->

> > i think you'll find some get it right, some
> > come close, and other simply don't know where to begin.
> 
> that's the case in any assignment i give them.  if i told them to write
> a routine to add two numbers i would get the same result.

<-snip->

you employ junior programmers who wouldn't know how to begin adding two
numbers together?

how much do you pay them? 
('cause i've got a brother looking for work see, and he doesn't know which
end of the mouse to tread on...)

<GRIN>

iain

(attributions snipped to protect the purposely misunderstood)

Iain Chalmers
bigiain@mightymedia.com.au


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

Date: Wed, 26 Nov 1997 04:43:12 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: PERL Hourly Rates
Message-Id: <65g7k4$osc@bgtnsc03.worldnet.att.net>

In article <bigiain-ya02408000R2611971426550001@news.ozemail.com.au>,
bigiain@mightymedia.com.au (Iain Chalmers) wrote:

> > > i think you'll find some get it right, some
> > > come close, and other simply don't know where to begin.
> > 
> > that's the case in any assignment i give them.  if i told them to write
> > a routine to add two numbers i would get the same result.

> you employ junior programmers who wouldn't know how to begin adding two
> numbers together?

the ones who can't perform don't last long.  the trouble is that there
is a serious shortage of [good] Perl programmers, so you have to train
them on the job.  some people do very well in a learning environment,
others need lots of structure and guidance.

to further complicate matters, i'm still learning to how
interview people so i find out what they really know - it seems anyone
can find three people to say good things about them, especially when
the headhunters have prepped them :)

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


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

Date: 26 Nov 1997 04:45:02 GMT
From: Zenin <zenin@best.com>
Subject: Re: PERL Hourly Rates
Message-Id: <880519689.492857@thrush.omix.com>

Randal Schwartz <merlyn@stonehenge.com> wrote:
: Probably the most embarassing code I've written was the first Perl
: code to be part of the "public record", as one of the exhibits in my
: trial.  Awful stuff, actually... just a quick hack.  (Remember that
: the next time you write a quick hack... you may have to defend it in
: court. :-)

	I'm framing this. :-)

-- 
-Zenin
 zenin@best.com


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

Date: 26 Nov 1997 11:27:37 GMT
From: toutatis@no.mail.please (Toutatis)
Subject: Re: PERL Hourly Rates
Message-Id: <toutatis-ya023180002611971227330001@news.euro.net>

comdog@computerdog.com (brian d foy) wrote:

> toutatis@no.mail.please (Toutatis) wrote:
> 
> > Oh, by the way, there's a bug in your cgi program
> > http://computerdog.com/Cgi/demo/wrap.cgi
> > check your error log for a 500 response ;-)
> 
> i couldn't reproduce any error.  if you would like to submit a more helpful
> bug report, please do so privately.  this sort of thing is not germaine to
> the discussion.  i would respond in email but you've munged your address.

Thank you for perfectly illustrating my point. CGI scripting is _not_ as
trivial as you're suggesting. The fact that you probably relied too much on
Text::Wrap (with a die statement where it'd better not be) is foregivable.
That you didn't test every condition under wich your script is used is
somewhat understandable. You're a busy man. The fact you need additional
information from me to reproduce the error leads me to believe you didn't
properly configure your scripts and/or httpd to provide you the essential
debugging information (Text::Wrap is not _that_ buggy that it doesn't
exactly tell you _why_ it invoked a die). Or are your logs so stuffed with
500 response codes you wouldn't know where to look?

-- 
Toutatis


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

Date: 26 Nov 1997 10:59:40 GMT
From: "Robert Friberg" <robert.friberg@your_clothes.eductus-vast.com>
Subject: Re: print "Location: http://www.my_html.html\n\n";     and open a browser.. ?
Message-Id: <01bcfa59$d059a320$c82da8c0@akilles.ittek.org>


Some lost poor soul wonders:
> I am wanting to open another window.. with the this command line
> 
> print "Location: my_html.html\n\n";
> 
> 
> I have tried putting target=_blank which is what the html command
> would be but it does not seem to work.. 

Not much of a perl question really....you can't tell the browser
where to send the output. Seems like you'll have to twitch it
somehow...

# untested
print << EOT;
Content-type: text/html

<html><script>open('my_html.html', 'windowname')</script></html>
EOT

An alternative is putting the target="_blank" in the tag that
calls the script, like <form action="/scripts/this.pl" target="_blank">
but that's certainly not perl. This works fine only if you want a blank
window *every* time.

Check out these ng's:
  comp.infosystems.www.authoring.cgi
  comp.infosystems.www.authoring.html
  alt.html
  alt.lang.javascript


-- 
/robban



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

Date: 26 Nov 1997 02:28:05 GMT
From: ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au>
Subject: Re: Regex for three equal characters
Message-Id: <880511198.750616@cabal>

In <comdog-ya02408000R2411971456300001@news.panix.com> comdog@computerdog.com (brian d foy) writes:

>In article <880249844.222361@cabal>, ? the platypus {aka David Formosa} <dformosa@st.nepean.uws.edu.au> wrote:

>>In <34718702.E20CA18@siemens.ch> Markus Bubendorf <markus.bubendorf@siemens.ch> writes:
>>
>>>I'm looking for a regex which matches three or more consecutive equal
>>>characters. Any ideas?
>>
>>/(.)\1\1/ should do it.

>that only matches three cosecutive characters...

It metches three equal characters wich is what the person asked in the 
subject line.

/(.)\1\1*/

Matchers what the person asked in the body.  I'm a programmer if I'm given
confilicting specks I'll interprate them in the way to give me the less
typing.


--
Please excuse my spelling as I suffer from agraphia see the url in my header. 
Never trust a country with more peaple then sheep. I do not reply to mungged 
Support NoCeM http://www.cm.org/                   addresses.  
I'm sorry but I just don't consider 'because its yucky' a convincing argument


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

Date: Wed, 26 Nov 1997 04:45:05 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Regex for three equal characters
Message-Id: <65g7nk$osc@bgtnsc03.worldnet.att.net>

In article <880511198.750616@cabal>, ? the platypus {aka David Formosa}
<dformosa@st.nepean.uws.edu.au> wrote:

> It metches three equal characters wich is what the person asked in the 
> subject line.
> 
> /(.)\1\1*/
> 
> Matchers what the person asked in the body.  I'm a programmer if I'm given
> confilicting specks I'll interprate them in the way to give me the less
> typing.

fair enough - if you can't choose a good subject line you deserve what
you get ;)

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


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

Date: 26 Nov 1997 10:11:35 GMT
From: "James Richardson" <jamesr@aethos.co.uk.nospam>
Subject: Re: Removing Files older than 14 days
Message-Id: <01bcfa54$420d5c60$26c0a4c1@kitkat.aethos.co.uk>

Hugh <hnews@harvest-lodge.demon.co.uk> wrote in article
<880492908.29258.0.nnrp-02.c2de48f0@news.demon.co.uk>...
> I am having difficulty writing an efficient script to delete all files in
a
> preset directory over a certain age. If a file is older than 14 days I
want
> to delete it. There are likely to be upwards of a couple of thousand or
so
> files in the directory. How is the best way to check the create dates and
> delete if appropriate. As I said there is no need to recurse subdirs as
they
> won't exist. All files to be deleted will have a .ABC suffix, the routine
> should ignore files without this.
> 
> Thanks
> 
> Hugh
> Hugh@harvest-lodge.demon.co.uk
> 
> 
> 
> 
> 

#!/bin/sh

TOP_DIR=/home/hugh/temp_files

find $TOP_DIR -name '*.ABC' -mtime +14 -print | perl -nle 'unlink;'


(From the FAQ!!!!!)

Should do the trick.....

It will recurse if there are any sub directories

The 'all perl' way to do it would be something like:

opendir (MYDIR, "$DIRECTORY_NAME");
foreach $file (grep(/\.ABC$/, readdir(MYDIR))) {
	unlink $file if -M $file > 14;
}

James Richardon



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

Date: 26 Nov 1997 10:43:44 GMT
From: kthl@msg.ti.com (Thana Letchumi)
Subject: send mail using perl5
Message-Id: <65guh0$j1j$1@tilde.csc.ti.com>

hi,
  I'm  writing a perl script using cgi.pm modules (on Windows NT) to interface 
with web for user entry form. I need to know how I could send an automated 
mail to receipients with the user input as the message to send?.
Thanks.

Regards,
  



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

Date: 26 Nov 1997 10:47:37 GMT
From: "Greg McDermid" <mcdermidg@acm.org>
Subject: Silly diamond operator (<>) problem?
Message-Id: <01bcfa60$fde92250$89ba0ccb@gregii>

Hi,

until recently I have been using the activestate (ex hip communications)
perl, then I switched to the standard perl distribution (V 5.004 Win32
under NT 4). At this point a lot of my scripts started failing, most have a
very basic structure like:

while (<>)
{
	...
}

The problem is that if the input is a specified list of files, or
redirected input it works OK, but if I use wildcards it fails, e.g.  perl
x.pl *.err, the error being like "Can't open *.err". Is there something
silly I missed here?


Regards,

Greg

e-mail: mcdermidg@acm.org


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

Date: 26 Nov 1997 04:24:55 GMT
From: tfletche@pcocd2.intel.com (Terry Michael Fletcher - PCD ~)
Subject: Re: sum in assoc array
Message-Id: <65g8an$itb$1@news.fm.intel.com>

Terry Michael Fletcher - PCD ~ (tfletche@pcocd2.intel.com) so eloquently and verbosely pontificated:
> 
> $i = 0;
> for $key (R,I,A,S,E,C) {
>         $RESULTS{$key} =
> 		eval eval 'join "+", 
> 			map { $SUM{$_} =~ /^(?:\d+\s+){$i}(\d+)/ } 
> 			keys %SUM';       # note this  ^^  index here
>         $i++;
> }

hmmm, this could be written even better, if anyone cares....

> note:
> 2) you dont have to care what the keys of %SUM are.
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

duh...  this is better written as:

$i = 0;
for $key (R,I,A,S,E,C) {
        $RESULTS{$key} = eval eval 'join "+", 
		map { /^(?:[\d.]+\s+){$i}([\d.]+)/ } values %SUM';
        $i++;                                      # ^^^^^^
}

it still wasnt bad as a first brainstorm, but i gotta admit, this looks
much cleaner.

oh well.

-- 
#!/usr/local/bin/perl -w
print   "J"                      ."u".        #    -- Terry Fletcher
        "s"    ."t".    " A",     "n"         # tfletche@pcocd2.intel.com
   .    "o"   ,""."".   "the",    "r ","P".   #  Views expressed....not
   "e"."rl"   ." Ha",   "c",''    .""  ."".   #  INTeL's....yadda yadda
      ""            ,   "k".      "e"  ."r"   #          yadda....


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

Date: 26 Nov 1997 04:50:54 GMT
From: Zenin <zenin@best.com>
Subject: Re: System runs as sub-process...
Message-Id: <880520042.113080@thrush.omix.com>

Randal Schwartz <merlyn@stonehenge.com> wrote:
	>snip<
: Egad!  Was *that* what that stuff was?  I had *no* clue.  I just
: cut-n-pasted command lines, honest, officer!

	So _that's_ how you ended up in court. :-)

-- 
-Zenin
 zenin@best.com


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

Date: Wed, 26 Nov 1997 00:58:24 -0500
From: Brian <nyc-guy@ix.netcom.com>
Subject: Text Matching
Message-Id: <347BBA80.3794C31F@ix.netcom.com>

I am trying to chop up a like of text that looks like :
ABC "XXXXX" GHI

I want to do a search on the line of text and store the data
between the two quotes into a variable.  Any help on
how to do this would be extremely helpful.

Regards,
Brian




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

Date: Wed, 26 Nov 1997 07:33:23 -0500
From: comdog@computerdog.com (brian d foy)
Subject: Re: Text Matching
Message-Id: <65ghj6$d0g@bgtnsc03.worldnet.att.net>

In article <347BBA80.3794C31F@ix.netcom.com>, nyc-guy@ix.netcom.com wrote:

> I am trying to chop up a like of text that looks like :
> ABC "XXXXX" GHI
> 
> I want to do a search on the line of text and store the data
> between the two quotes into a variable.

if there are no other quotes around, you could do something like

   #!/usr/bin/perl -w

   $_ = q|ABC "XXXXX" GHI|;

   m/ \s+    #some whitespace
       "     #a double quote
      (.*?)  #anything, but not greedily
       "     #a double quote
      \s+    #some whitespace
    /x;  #eXtended format

   print "matched [$1]\n";

   __END__

   matched [XXXXX]

-- 
brian d foy                                 <http://computerdog.com>
#!/usr/bin/perl
$_=q|osyrNewkecnaYhe.mlorsePptMskurj|;s;[NY.PM]; ;g;local$\=
qq$\n$;@pm=split//;while($NY=pop @pm){$pm.=$NY;$ny.=pop @pm}
$pm=join'',reverse($ny,$pm);open(NY,'>&STDOUT');print NY $pm


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

Date: Wed, 26 Nov 1997 05:21:20 -0600
From: venkat5@hotmail.com
Subject: use of chdir in backquote
Message-Id: <880542687.21842@dejanews.com>
Keywords: chdir in backquote

could anyone please heip me in how to use chdir(change directory) in
backquotes.
 print `chdir \dir1`;    is not working.
i am using Perl5.001 under WinNT 4.0
Regards.
venkat

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


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

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1375
**************************************

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