[19147] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 1342 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 20 11:10:35 2001

Date: Fri, 20 Jul 2001 08:10:12 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <995641812-v10-i1342@ruby.oce.orst.edu>
Content-Type: text

Perl-Users Digest           Fri, 20 Jul 2001     Volume: 10 Number: 1342

Today's topics:
    Re: is the UK serious about perl? (Jacqui caren)
    Re: Newbie-best way to store querystrings values in var <ken@me.com.au>
        Newbie: apologies for the daft message <bowed_zombie_drone.spam.begone@zombie.co.uk>
    Re: Newbie: apologies for the daft message <rsherman@ce.gatech.edu>
    Re: Newbie: apologies for the trivial content <bowed_zombie_drone.spam.begone@zombie.co.uk>
    Re: read the 9th column <monty@primenet.com>
        Redirecting STDERR <f_dubru@yahoo.com>
    Re: Removing Tags <iltzu@sci.invalid>
    Re: Search and replace using perl (Lack Mr G M)
    Re: Search and replace using perl (Tad McClellan)
    Re: tab sperated line to named hash? <twanGEENSPAM@twansoft.com>
    Re: tab sperated line to named hash? (Tad McClellan)
    Re: tab sperated line to named hash? <twanGEENSPAM@twansoft.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Fri, 20 Jul 2001 12:46:05 GMT
From: Jacqui.Caren@ig.co.uk (Jacqui caren)
Subject: Re: is the UK serious about perl?
Message-Id: <90E48EC7CJacquiCarenigcouk@195.8.69.73>

uri@sysarch.com (Uri Guttman) wrote in <x7r8vcvmo2.fsf@home.sysarch.com>:

>>>>>> "Jc" == Jacqui caren <Jacqui.Caren@ig.co.uk> writes:
>
>  Jc> US based companies seem to use perl for serious business
>  Jc> critical systems whereas UK based vacancies imply 'toy'
>  Jc> web usage of perl/DBI. Also adverts from UK companies
>  Jc> lack that quality feel that the majority of US posters
>  Jc> seem to give out. I honestly wonder if any decent perl
>  Jc> folks even bother to reply to such badly structured
>  Jc> 'desperate sounding' adverts.
>
>i see regular posts for perl hackers in the UK on the perl jobs
>list. search the archive to see them.

perhaps you missed

>  Jc> I am curious if anyone else has seen a pattern emerging
>  Jc> upon the perl jobs mailing list.

:-)

Seriously, I have been waching this list for quite a while
(year or so). and the only 'decent' adverts that someone
of my ilk would consider applying for are US based.
The only UK adverts I have seen have been for web 'script
kiddies'. I was weaned off that sort of stuff >~5 years ago.

I do have an interest in this subject as we may be advertising
a perl position(s) in the near future (planned expansion) and I
am curious as to the 'competition' in the UK for 'perl professionals'.

I say perl professionals because I **hate** the term perl hackers.

  Hackers infer small tacky unplanned scripts.

  Professionals plan work before writing code, create test
  plans and use tools such as Clearcase etc. Skills and
  attitude are the difference between a hacker and a professional.

I have worked with some very good 'hackers' and they are often
perfect for small short lifespan systems but when you are dealing
with core systems for a major telco or similar they have to be sure
that what you have done will work and continue to work otherwise
a lot of money can be lost.
For a business such as ourselves reputation is our lifeblood and
to protect that requires a professional approach to the job and
you don't get the required skillsets for such work doing 20 minute
web script projects :-)

One of the elements of our rep. was that all dev staff had at least
10 years industry experience. We had no 'juniors' - we now have two
members of staff will approx 3 years ind exp, so that is no longer
true, however, it has taken time to ensure the 'new' recruits use CM
systems correctly, do good unit testing and prepare for system tests
etc. This means that even with three years in industry the best
people we could find had to relearn what I would consider basic
skills such as creating unit tests, bounds testing, good debug
and trace strategies and a fast and effective waterfall model
for stable continuous development.

In many UK businesses (web) I have worked with, 3 years exp. would
make you the most experienced developer/consultant in that company.
You would probably be technical director ;-)

The last time we advertised a perl position it took over three months
to fill the position - we only had three or four reasonable applicants.
The rest were script kiddies or clueless wannabees.

I had expected that there would have been more 'professional' perl
vacancies in the Uk by now but all this means is that we have
little competition when we get around to expanding again. Good news
for us - bad for the perception/reputation of perl within the UK.

Jacqui


p.s. I have been at IG for approx 10 years and do not plan to change
jobs at the mo so please dont take this posting as a "I wanna job"..


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

Date: Sat, 21 Jul 2001 00:44:54 +1000
From: "Ken Cotterill" <ken@me.com.au>
Subject: Re: Newbie-best way to store querystrings values in variables.??
Message-Id: <YqX57.314$Kn3.23449@nostril.pacific.net.au>

Flag FComo,

For single-valued parameters like these, I just use:

use CGI;
my $q = CGI->new;
my %param;
foreach ( $q->param ) { $param{$_} = $q->param($_) }

You can then just sling a reference to this hash around and access the
variables as $rh_param->{email}, for instance.

I'd use the same hash for multi-valued parameters, e,g, from checkboxes,
with the hash key pointing to an anonymous hash containing the checkbox
NAME= and VALUE= pairs as the hash key/value pairs.

There's quite a lot of doco on these data structures - perldsc & perllol
come to mind.
If you're new to Perl, you should probably also check the doco for
references - perlref I think.

Regards,

Ken.

"Flag FComo" <flag@como.com> wrote in message
news:%u707.62406$6d.871293@news.easynews.com...
> Sorry about this question, I'm new to cgi., I come from .asp
>
> I have want to go to a cgi file with querystrings:
>
> http://www.domain.com/cgi-bin/file.cgi?user=user&pass=pass&email=email
>
> Which would be the best way to store this information in variables
> $user
> $pass
> $email
>
> thanks in advance for any help
>
>




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

Date: Fri, 20 Jul 2001 15:25:35 +0100
From: "Noah" <bowed_zombie_drone.spam.begone@zombie.co.uk>
Subject: Newbie: apologies for the daft message
Message-Id: <ncX57.23893$B5.2120656@monolith.news.easynet.net>

I'm a newbie - please be gentle with me...

I've inherited a Perl program to maintain & am learning
the language on the fly.

I have a question: one line of code includes this:

m/\TEST/

I know it's a pattern match, but what does the
backslash indicate? I've had a look through my
Perl books & have found that it would refer to
a tab if it was \t, but doesn't mean that, I'm sure...
I'm not sure what it does mean, though

Any help would be appreciated.
--
Noah
Remove ".spam.begone"




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

Date: Fri, 20 Jul 2001 10:56:14 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Newbie: apologies for the daft message
Message-Id: <3B57C7FE.438822C1@ce.gatech.edu>

Noah wrote:
> 
> I'm a newbie - please be gentle with me...
> 
> I've inherited a Perl program to maintain & am learning
> the language on the fly.
> 
> I have a question: one line of code includes this:
> 
> m/\TEST/
> 
> I know it's a pattern match, but what does the
> backslash indicate? I've had a look through my
> Perl books & have found that it would refer to
> a tab if it was \t, but doesn't mean that, I'm sure...
> I'm not sure what it does mean, though
> 
> Any help would be appreciated.
> --
> Noah
> Remove ".spam.begone"


post some of the relevant code and someone might be able to figure it
out, but without context it is difficult to tell if it is just a typo...


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

Date: Fri, 20 Jul 2001 16:03:50 +0100
From: "Noah" <bowed_zombie_drone.spam.begone@zombie.co.uk>
Subject: Re: Newbie: apologies for the trivial content
Message-Id: <sLX57.23897$B5.2124454@monolith.news.easynet.net>

> post some of the relevant code and someone might be able to figure it
> out, but without context it is difficult to tell if it is just a typo...

Ok... the line is as follows:

if( ... && $param->{'sessionhandleR'} !~ m/\TEST/ && ... )

--
Noah
Remove ".spam.begone"




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

Date: 20 Jul 2001 14:55:59 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: read the 9th column
Message-Id: <9j9gpv$ala$1@nnrp2.phx.gblx.net>

Alexvalara <alexvalara@aol.com> wrote:
> > And if your ls understands the -1 switch :
> >   ls -1
>
> Thanks man. It is the think i need.

It's not the thing you *need* if you're either piping or redirecting
the output of ls. In that case, you don't need the -1 option:

    ls | ...
    ls > ...

In any case, the ninth word on a line of 'ls -l' output is not the
whole path/file name for any directory or file that has a space in
it.

-- 
Jim Monty
monty@primenet.com
Tempe, Arizona USA


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

Date: Fri, 20 Jul 2001 13:53:51 GMT
From: "Fred" <f_dubru@yahoo.com>
Subject: Redirecting STDERR
Message-Id: <PJW57.111$jr7.27847770@news2.randori.com>

Hi,

I am trying to redirect the errors generated by one script on win32. I use
the following command:

  scriptname > out.txt 2>&1

If the STDOUT is correctly redirected, none of the error messages are sent
to the file.

Any idea why??

Thanks for you time.

Fred









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

Date: 20 Jul 2001 11:05:01 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Removing Tags
Message-Id: <995627037.19349@itz.pp.sci.fi>

In article <995618325.596.0.nnrp-01.c2de1f0e@news.demon.co.uk>, Lee Osborne wrote:
>
>Does someone have some code that removes HTML tags from a string? I don't
>want to use a module from cpan. I can use the RE:

I bet you could find some at http://groups.google.com

Heck, I *know* you will, if you look deep enough.

-- 
Ilmari Karonen -- http://www.sci.fi/~iltzu/
"Get real!  This is a discussion group, not a helpdesk.  You post something,
we discuss its implications.  If the discussion happens to answer a question
you've asked, that's incidental."           -- nobull in comp.lang.perl.misc



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

Date: Fri, 20 Jul 2001 10:57:50 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Search and replace using perl
Message-Id: <2001Jul20.105750@ukwit01>

In article <2NS57.36$vO5.940@news3.oke.nextra.no>, Loke <reply-to-group@please.com> writes:
|> 
|> I want to search for a string pattern in several files (several occurances 
|> in file also possible) in several directories and subdirectories, and 
|> replace every occurance with another string. 
|> 
|> However, files ending with ,v should not be altered (RCS files) Also,
|> symlinks should not be followed. I have tried the following, but cannot
|> make it work properly:

   You need to use "find".  Something like:

 find . -type f -not -name '*,v' | grep -l -r /local/net-status/mping * |
 xargs perl -i.bak -pe s%/local/net-status/mping/%/jalla/test%


-- 
--------- Gordon Lack --------------- gml4410@ggr.co.uk  ------------
This message *may* reflect my personal opinion.  It is *not* intended
to reflect those of my employer, or anyone else.



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

Date: Fri, 20 Jul 2001 09:21:31 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Search and replace using perl
Message-Id: <slrn9lgc2r.205.tadmc@tadmc26.august.net>

Loke <reply-to-group@please.com> wrote:
>
>I want to search for a string pattern in several files (several occurances 
>in file also possible) in several directories and subdirectories, and 
>replace every occurance with another string. 
>
>However, files ending with ,v should not be altered (RCS files) Also,
>symlinks should not be followed.

[snip]

>Any suggestions?

---------------------------------------
#!/usr/bin/perl -w
use strict;
use File::Find;

@ARGV = ();
find \&wanted, '.';

$^I = '.bak';  # enable inplace editing
while (<>) {
   s%/local/net-status/mping/%/jalla/test%g;
   print;
}

sub wanted {
   return unless -f;    # skip everything but plain files
   return if /,v$/;     # skip RCS files

   push @ARGV, $File::Find::name;
}
---------------------------------------


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 20 Jul 2001 15:57:06 +0200
From: Twan Kogels <twanGEENSPAM@twansoft.com>
Subject: Re: tab sperated line to named hash?
Message-Id: <5sdglt07jkoget00e4naroft3fo6q8r3ks@4ax.com>

On Thu, 19 Jul 2001 22:36:13 -0600, pt
<mnemotronic@mind\no-spam/spring.com> wrote:


>   Read this with something like
>while (<DATA>)
>{
>   last if /^#\s*end/ ;
>   my ($key,$idx) = split /,/ ;
>   # here's where you would store $key and $idx .....
>}
>
>    You now need to provide a data structure that will contain the names
>and indices.  The type of data structure depends on how you want to get
>the data into, and more importantly out of, '%forumprop'.
>Possibilities:
>    1.  Make each value of %forumprop a 2 element array.  One element
>would contain the index of @data, the other element would contain the
>actual data.  You can then iterate the keys of %forumprop and assign
>data from @data.  This has the benefit of being self contained, but the
>drawback of inefficient data retrieval, since every place you get a data
>item must include an array index.
>    2.  An independent data structure (either a hash or array)
>containing the name and index.  There are several possibilities.
>
>This will allow you to assign all elements of @data using a simple loop,
>instead of several hundred assignment lines.
>

Thanks! I already have implented your idea. I made a lookup hash:

#lookup hash
%propindex=(
"forum_title", 0,
"bg_header", 1,
"tb_normal_tags", 2,
 ...
"flood", 183,
"keur", 184
);

#split dataline
chomp($dataline);
@forumprop=split("\t", $dataline);

this way i can easily get properties:

#get forum title
my $title=$forumprop[$propindex{'forum_title'}];

Thanks again for your suggestion and reply,
Twan
-- 
W.I.E. , wie is er op je website?:
http://www.twansoft.com/wie/


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

Date: Fri, 20 Jul 2001 09:44:15 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: tab sperated line to named hash?
Message-Id: <slrn9lgddf.26q.tadmc@tadmc26.august.net>

Twan Kogels <twanGEENSPAM@twansoft.com> wrote:
>On Thu, 19 Jul 2001 22:36:13 -0600, pt
><mnemotronic@mind\no-spam/spring.com> wrote:


>Thanks! I already have implented your idea. I made a lookup hash:
>
>#lookup hash
>%propindex=(
>"forum_title", 0,
>"bg_header", 1,
>"tb_normal_tags", 2,
>...
>"flood", 183,
>"keur", 184
>);


You do not need the indexes if you use an array instead of a hash.


>#split dataline
>chomp($dataline);
>@forumprop=split("\t", $dataline);
>
>this way i can easily get properties:
>
>#get forum title
>my $title=$forumprop[$propindex{'forum_title'}];


I though 'forumprop' was to be a hash that you want loaded. If so,
then you can still easily get properties, without typing 200
index numbers.

   my $title = $forumprop{forum_title};


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


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

Date: Fri, 20 Jul 2001 16:55:55 +0200
From: Twan Kogels <twanGEENSPAM@twansoft.com>
Subject: Re: tab sperated line to named hash?
Message-Id: <1rgglt8qtedva3c8p04lfg7ftcb5n36953@4ax.com>

On Fri, 20 Jul 2001 09:44:15 -0400, tadmc@augustmail.com (Tad
McClellan) wrote:

>Twan Kogels <twanGEENSPAM@twansoft.com> wrote:
>>On Thu, 19 Jul 2001 22:36:13 -0600, pt
>><mnemotronic@mind\no-spam/spring.com> wrote:
>
>
>>Thanks! I already have implented your idea. I made a lookup hash:
>>
>>#lookup hash
>>%propindex=(
>>"forum_title", 0,
>>"bg_header", 1,
>>"tb_normal_tags", 2,
>>...
>>"flood", 183,
>>"keur", 184
>>);
>
>
>You do not need the indexes if you use an array instead of a hash.

But i need to know the index of a property in a array, otherwise i
cannot get the value of the array item.


>>
>>#get forum title
>>my $title=$forumprop[$propindex{'forum_title'}];
>
>
>I though 'forumprop' was to be a hash that you want loaded. If so,
>then you can still easily get properties, without typing 200
>index numbers.
>
>   my $title = $forumprop{forum_title};

In my orginal code (my first post) it was indeed a hash, in the
orginal situation i could get a property with the following code:

my $title=$forumprop{'forum_title'};

but to fill the hash i needed to write:

@data=split("\t", $dataline);
$forumprop{'forum_title'}=$data[0];
(200 times per property)

Now i have a lookup hash:

%propindex=(
"forum_title", 0,
"keur", 184
);

and a array:
@forumprop=split("\t", $dataline);

this way i avoid 200 assignments. And i can just lookup the index of a
specific property in the %propindex hash:

my $title=$forumprop[$propindex{'forum_title'}];

or a little clearer:

my $propind=$propindex{'forum_title'};
my $title=$forumprop[$propind];

Twan
-- 
W.I.E. , wie is er op je website?:
http://www.twansoft.com/wie/


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

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 1342
***************************************


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