Strange

2015-06-11 Thread Jerry Rocteur
Hi,

What has happened to this mailing list ?

This list was great with lots of smart people answering all sorts of questions. 
And this is a place I learned a lot about Perl

After a long absence I decided to subscribe again to see what was being talked 
about and … NOTHING ..

What happened to the list ? Where has everybody gone to ?


Jerry Rocteur




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Strange Data space wipe out with hashes

2009-09-17 Thread Jerry Rocteur
Hi,

I came across this problem and thought I'd run it by the list so that perhaps 
someone can explain to me what is going on

Given a script with the following hash definition

#!/usr/bin/perl

use warnings;
use strict;

my %sib_master_hoa  = (
=> [ ' ' ] ,
_ERSALL => [ ' ', 'ERS CRCODOSS ', 'ERS ENVDOSS 
', 'ERS ENVVAL ' ],
_ERSOTHERS  => [ ' ', 'ERS CRCODOSS ', 'ERS ENVVAL 
' ],
);

sub AddGroup {
my ($sib_user, $sib_profile, $sib_sibprofx) = @_;
#
for my $profile ( @{ $sib_master_hoa{$sib_profile}  } ) {
$profile =~ s//$sib_sibprofx/g;
print  "-A $sib_user -g $profile\n";
}

}   
 #
#  Main MAIN
   #

AddGroup("jerry","","ONE");
AddGroup("laurence","","TWO");
AddGroup("ralf","_ERSALL","ONE");
AddGroup("randal","_ERSALL","TWO")
#EOF

The output I get is:

-A jerry -g  ONE
-A laurence -g  ONE
-A ralf -g  ONE
-A ralf -g ERS CRCODOSS ONE
-A ralf -g ERS ENVDOSS ONE
-A ralf -g ERS ENVVAL ONE
-A randal -g  ONE
-A randal -g ERS CRCODOSS ONE
-A randal -g ERS ENVDOSS ONE
-A randal -g ERS ENVVAL ONE

The values in the array in the hash are being changed but not by me ?

I've run this on  perl, v5.8.0 built for PA-RISC1.1-thread-multi and  perl, 
v5.6.1 built for x86_64-linux with the
same result.

If I define the hash inside the function I don't get the problem but I'm still 
confused about what is going on. I've
never seen anywhere yet that I can't define this kind of hash globally. This of 
course does not mean no one has said
it.

Thanks in advance for any ideas.


Jerry




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: reading files c vs perl

2009-04-15 Thread Jerry Rocteur


On 15 Apr 2009, at 13:01, John W. Krahn wrote:


Dermot wrote:

2009/4/14 Chas. Owens :

On Tue, Apr 14, 2009 at 11:49, Rick  wrote:

is it true that perl will be just as fast as c for reading files ?

for example


cow...@amans:~$ time cat /usr/share/dict/words | perl wc.pl
my $count = 0;

$/ = \4096;
while (<>) {
  $count += tr/\n//;
}

print "$count\n";

That's a sneaky way to count lines :)


Not really.  See the FAQ:

perldoc -q "How do I count the number of lines in a file?"



John,

How does one memorize the entire FAQ ?

As you have no doubt done!

J

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: use SDBM_File - Can't use string as a HASH ref

2009-03-13 Thread Jerry Rocteur
> On Thu, Mar 12, 2009 at 09:20, Jerry Rocteur  wrote:
>> Hi,
>>
>> I'm trying to tie this kind of hash into SDBM
>>
>> $hash_of_baseline{$hdr_user_name} = { user_name => $hdr_user_name,
>>passwd  => $hdr_user_passwd,
>> ...
>> ...
>>    groups  => [ @info_group_names ] };
>>
>> I can store it but when I read it back I get.
>>
>> Can't use string ("HASH(0x1db393b0)") as a HASH ref while "strict refs" in 
>> use at
>>
>> I think I understand from what I've googled that I can't use SDBM for this 
>> kind of structure.
>>
>> I searched around and found MLDBM.
>>
>> I'm looking for advice, is this the best solution or am I on the wrong track 
>> ?
> snip
>
> DBM files can only store simple values like strings and numbers.  You
> are trying to store a complex data structure in one.  The general
> method of solving this problem is to use the Storable module* to
> serialize the data structure as a string before storing it in the DBM,
> or to use a module like DBM::Deep** that automates this for you.
> [...]
> [...]
>
> print Dumper \%deep, \%new;
>
> * http://perldoc.perl.org/Storable.html
> ** http://search.cpan.org/dist/DBM-Deep/lib/DBM/Deep.pod

Thanks very much Chas. I really appreciate this. I am glad I asked the question 
to the list.

I will look into the easiest solution, I don't like having to integrate a new 
module into the system build unless
absolutely necessary so I will study it carefully.

My idea of storing into DBM was to speed up initial access to the data!

Have a GREAT weekend,

Jerry




-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




use SDBM_File - Can't use string as a HASH ref

2009-03-12 Thread Jerry Rocteur
Hi,

I'm trying to tie this kind of hash into SDBM

$hash_of_baseline{$hdr_user_name} = { user_name => $hdr_user_name,
  passwd=> $hdr_user_passwd,
...
...
  groups  => [ @info_group_names ] };

I can store it but when I read it back I get.

Can't use string ("HASH(0x1db393b0)") as a HASH ref while "strict refs" in use 
at

I think I understand from what I've googled that I can't use SDBM for this kind 
of structure.

I searched around and found MLDBM.

I'm looking for advice, is this the best solution or am I on the wrong track ?

Thanks in advance,

Jerry


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




use SDBM_File - Can't use string as a HASH ref

2009-03-12 Thread Jerry Rocteur
Hi,

I'm trying to tie this kind of hash into SDBM

$hash_of_baseline{$hdr_user_name} = { user_name => $hdr_user_name,
  passwd=> $hdr_user_passwd,
...
...
  groups  => [ @info_group_names ] };

I can store it but when I read it back I get.

Can't use string ("HASH(0x1db393b0)") as a HASH ref while "strict refs" in use 
at

I think I understand from what I've googled that I can't use SDBM for this kind 
of
structure.

I searched around and found MLDBM.

I'm looking for advice, is this the best solution or am I on the wrong track ?

Thanks in advance,

Jerry


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Multiple line parameters in parameter file

2006-08-02 Thread Jerry Rocteur
Hi,

I've just searched the web and tried the archives but that is down at the 
moment.

I'm reading a parameter file:

PARAM=value
PARAM1=value2

Etc. and this works great, but all of a sudden...I need multiple lines..

For example:

login=logname
password=password
ftpfiles="/var/opt/file1, /var/opt/file2, /var/opt/file3
  /var/opt/file4, /var/opt/file5 f/var/opt/ile6,
  /var/opt/file7"
oracleftpport=2111


The file names are relative and so quite long so probably better to put one on 
each line ?

I've thought of slurping in paragraph mode but I'm really stuck for a good way 
to do it..

Perhaps a module ?

Any ideas ?

Thanks in advance,


-- 
  _Jerry Rocteur[EMAIL PROTECTED]
_|_|_   http://www.rocteur.cc
(0 0)   MSN [EMAIL PROTECTED]
ooO--(_)--Ooo  Jabber [EMAIL PROTECTED]
_




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Multiple line parameters in parameter file

2006-08-02 Thread Jerry Rocteur
Hi,

I've just searched the web and tried the archives but I'm not in luck

I'm reading a parameter file:

PARAM=value
PARAM1=value2

Etc. and this works great, but all of a sudden...I need multiple lines..

For example:

login=logname
password=password
ftpfiles="/var/opt/file1, /var/opt/file2, /var/opt/file3
  /var/opt/file4, /var/opt/file5 f/var/opt/ile6,
  /var/opt/file7"
oracleftpport=2111


The file names are relative and so quite long so I prefer to put one on each 
line ?

I've thought of slurping in paragraph mode but I'm really stuck for a good way 
to do it..

Perhaps a module ?

Any ideas ?

I can do this any other way, I just need to pass these parameters, I can do it 
any way I want..

I prefer not having two parameter files but ... 

Thanks in advance,


Jerry

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: perl almost an adult? [was: s/// w/o RE]

2004-04-18 Thread Jerry Rocteur
John W. Krahn wrote:

Furrfu, kids today.  When I starting programming in Perl there was one
man page, no books and no web sites.  :-)


John
 

But Tom Christiansen was there and whenever you ran a UNIX command he 
would tell you to do it in Perl and if you didn't know how, he'd show 
you even if you didn't want to know how to do it in Perl  ;-))

We don't hear from Tom Much on the web anymore. In the old days he 
was very active especially on UNIX lists...

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Jerry Rocteur
On Saturday, Dec 13, 2003, at 18:12 Europe/Brussels, Jerry Rocteur 
wrote:

Hi,

I'm trying to be a good boy and use strict and warnings ..

The more I do, the more I feel I'm wasting so much time and should 
become productive, my code looks full of 'my', I could understand the 
requirement inside a sub routing but in the main code it gives me the 
willies. My DBI Perl is even more of a headache ;-((

Anyway, enough whining, now I've going through code that is working 
and thought I'd see the big difference if I change it to use warnings 
and strict and this little routing gives me  'Use of uninitialized 
value in pattern match (m//) at ./getopt.pl line 14.'

Line 14 is the while line..

I've tried all sorts of stuff with defined but keep getting syntax 
errors. I've tried perldoc warnings and perldoc perllexwarn .. In any 
case, unless I'm really missing something, I can't see what could be 
problematic with the while statement below, of course this shows my 
ignorance but as I've decided to use warnings and strict, I want to do 
it right..

How would a pedant code the following to avoid this warning.. Your 
answers will help me in the future.

#if ($#ARGV >= 0) { # What I've tried
while ($_ = $ARGV[0], /^-/) {
shift;
last if /^--$/;
if (/^-d(.*)/) { $debug++ }
elsif (/^-v(.*)/) { $verbose++ }
else { print "$_ unknown option\n";
Usage;
}
}
#}
Thanks in advance, I really want to put, Perl with warnings and strict 
in my CV ;-

Jerry




Sorry for the double post, my first post I had done with an email 
address that is not subscribed to the list, thinking it would not go 
through I reposted. I didn't realize you accepted posts from non 
subscribed addresses.

I thank all those that replied on and off list, great replies. Of 
course my question was more than answered.  Thanks to Wigins d'Anconia, 
Rob Dixon, R. Joseph Newton and drieux! Food for thought.  I'm still 
reviewing your replies..

Best Regards,

Jerry Rocteur

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>



Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-14 Thread Jerry Rocteur
Hi,

I'm trying to be a good boy and use strict and warnings ..

The more I do, the more I feel I'm wasting so much time and should 
become productive, my code looks full of 'my', I could understand the 
requirement inside a sub routing but in the main code it gives me the 
willies. My DBI Perl is even more of a headache ;-((

Anyway, enough whining, now I've going through code that is working and 
thought I'd see the big difference if I change it to use warnings and 
strict and this little routing gives me  'Use of uninitialized value in 
pattern match (m//) at ./getopt.pl line 14.'

Line 14 is the while line..

I've tried all sorts of stuff with defined but keep getting syntax 
errors. I've tried perldoc warnings and perldoc perllexwarn .. In any 
case, unless I'm really missing something, I can't see what could be 
problematic with the while statement below, of course this shows my 
ignorance but as I've decided to use warnings and strict, I want to do 
it right..

How would a pedant code the following to avoid this warning.. Your 
answers will help me in the future.

#if ($#ARGV >= 0) { # What I've tried
while ($_ = $ARGV[0], /^-/) {
shift;
last if /^--$/;
if (/^-d(.*)/) { $debug++ }
elsif (/^-v(.*)/) { $verbose++ }
else { print "$_ unknown option\n";
Usage;
}
}
#}
Thanks in advance, I really want to put, Perl with warnings and strict 
in my CV ;-

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Use of uninitialized value in pattern match (m//) at ./getopt.pl line 14.

2003-12-13 Thread Jerry Rocteur
Hi,

I'm trying to be a good boy and use strict and warnings ..

The more I do, the more I feel I'm wasting so much time and should 
become productive, my code looks full of 'my', I could understand the 
requirement inside a sub routing but in the main code it gives me the 
willies. My DBI Perl is even more of a headache ;-((

Anyway, enough whining, now I've going through code that is working and 
thought I'd see the big difference if I change it to use warnings and 
strict and this little routing gives me  'Use of uninitialized value in 
pattern match (m//) at ./getopt.pl line 14.'

Line 14 is the while line..

I've tried all sorts of stuff with defined but keep getting syntax 
errors. I've tried perldoc warnings and perldoc perllexwarn .. In any 
case, unless I'm really missing something, I can't see what could be 
problematic with the while statement below, of course this shows my 
ignorance but as I've decided to use warnings and strict, I want to do 
it right..

How would a pedant code the following to avoid this warning.. Your 
answers will help me in the future.

#if ($#ARGV >= 0) { # What I've tried
while ($_ = $ARGV[0], /^-/) {
shift;
last if /^--$/;
if (/^-d(.*)/) { $debug++ }
elsif (/^-v(.*)/) { $verbose++ }
else { print "$_ unknown option\n";
Usage;
}
}
#}
Thanks in advance, I really want to put, Perl with warnings and strict 
in my CV ;-

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: perl -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *

2003-12-03 Thread Jerry Rocteur
On Tuesday, Dec 2, 2003, at 21:06 Europe/Brussels, John W. Krahn wrote:

Jerry Rocteur wrote:
Hi,
Hello,

I'm trying to use perl for most shell stuff and this is some of the
stuff I'm using for grep ..
perl -ne 'print "$ARGV: $_" if /jerry/i ' *
perl -ne 'print  if /jer{1,}y/i ' *
perl -ne 'print  unless /jer{1,}y/i ' *
I'm enjoying this as I can do a lot more than I can with the old egrep
on our Solaris boxes..
What I'd like to do is to make a simple change NOT to check in binary
files and directories..
I've toyed with all sorts of variations and started like this.

perl -ne '-f &&print  if /satreq/ ' * # Don't laugh this is one of 
very
many attempts ;-((

Then I tried this:

perl  -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *

Which seems to do the trick but this is just excluding directories I
think..
But this gives me the same:

perl  -ne 'if(/.it/) {print "$ARGV: $_" unless -f}' *

How do I improve it to ONLY look in text files ?

I don't want to use the grep.pl's around or the grep from power tools,
I want to impress the ladies by typing these on the CLI ;-)) 
Seriously,
I love one liners..
Something like this might work (untested):

perl -ne' close ARGV unless -f ARGV && -T _; print if /jer+y/i ' *

From: Steve Mayer <[EMAIL PROTECTED]>
Jerry,
 Shouldn't you just be able to plug it in as you did below with the -d
 and -f operators?  Otherwise, you might be able to do something like
 this:
 perl -ne 'if( -T $ARGV && /.it/) {print "$ARGV: $_"}' *

Steve

Thanks very much for the answers on and off list.

I like these two above and I'll be testing them both during the next 
few days to see which one works the best..

Thanks heaps,

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


perl -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *

2003-12-02 Thread Jerry Rocteur
Hi,

I'm trying to use perl for most shell stuff and this is some of the 
stuff I'm using for grep ..

perl -ne 'print "$ARGV: $_" if /jerry/i ' *
perl -ne 'print  if /jer{1,}y/i ' *
perl -ne 'print  unless /jer{1,}y/i ' *
I'm enjoying this as I can do a lot more than I can with the old egrep 
on our Solaris boxes..

What I'd like to do is to make a simple change NOT to check in binary 
files and directories..

I've toyed with all sorts of variations and started like this.

perl -ne '-f &&print  if /satreq/ ' * # Don't laugh this is one of very 
many attempts ;-((

Then I tried this:

perl  -ne 'if(/rcn/) {print "$ARGV: $_" unless -d}' *

Which seems to do the trick but this is just excluding directories I 
think..

But this gives me the same:

perl  -ne 'if(/.it/) {print "$ARGV: $_" unless -f}' *

How do I improve it to ONLY look in text files ?

I don't want to use the grep.pl's around or the grep from power tools, 
I want to impress the ladies by typing these on the CLI ;-)) Seriously, 
I love one liners..

Thanks in advance,

Jerry 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


CGI - DBI

2003-12-01 Thread Jerry Rocteur
Hi,

I'm enjoying writing scripts using DBI, I'm doing it with Sybase and 
MySQL and it is a whole lot of fun.

I'd like to stick some stuff on the web and I've started playing with 
CGI but I hate this, almost as much as I hate creating HTML docs ;-)

Anyway, I decided not to re-invent the wheel and to search the web for 
some sample scripts, especially data entry stuff and I came across 
phpMyAdmin.. But of course I don't want to do PHP I want to do Perl, my 
ISP says, use Perl for all your scripts but if you want to do Web stuff 
just use PHP.. I don't want to do that, I saw a post from Jose and he 
talks about Mason, but my ISP doesn't have Mason.. Anyway, I've just 
tested and my ISP does have CGI and it works..

I was wondering, can anyone point me to some precooked Perl CGI scripts 
that already do data entry, I can browse and search my tables already 
in CGI and DBD but I loathe to make what I've done look reasonable and 
even worse, starting to create forms etc for data edit and data entry 
would make my hair even more grey than it is now..

Of course I don't mind modifying already working scripts and I 
certainly don't need anything too fancy ..

Thanks in advance for any help.

Jerry.

P.S. if someone can ask how to do a search and replace in Perl and 
people answer, I figure I can ask this  And I'm sure many of you 
have done it, send me your scripts ;-)

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


perldoc perltoc WAS Using Benchmark module

2003-11-26 Thread Jerry Rocteur
On Tuesday, Nov 25, 2003, at 20:11 Europe/Brussels, drieux wrote:

On Tuesday, Nov 25, 2003, at 10:29 US/Pacific, Paul Harwood wrote:
[..]
Perfect, thanks!

[..]

There are "Clear and Compelling" reasons why we
thump on folks about 'perldoc' is your friend.
For the life of me I can never remember the odd
bits that are in Perl - yet, with but a brief
waltz with your friend
	perldoc 

it is possible to find almost everything!
ciao
drieux
In as much as perldoc is your friend (Just like Google ;-) I find when 
you first use perldoc you get awfully confused as to which one to look 
for.

I like to use perldoc perltoc and of course 
http://www.perldoc.com/perl5.8.0/pod/perltoc.html is the bees knees..

Sorry if this is old news to most of you but I could not get 
comfortable with perldoc until I started using perldoc perltoc and this 
is a beginners list after all.

Best Regards,

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply to the list WAS Yahoo! Getter

2003-11-26 Thread Jerry Rocteur
On Tuesday, Nov 25, 2003, at 06:13 Europe/Brussels, Andrew Gaffney 
wrote:

Jason Dusek wrote:
On Monday, November 24, 2003, at 10:56 PM, Andrew Gaffney wrote:
There is atleast 1 Perl program for downloading Yahoo mail out 
there.
Okay, but let's say I want to /learn/ to do it - since I don't know 
anything about using Perl on the web.
Reply to the list!

--
Andrew Gaffney
I see this a lot of this on this list, Reply to the list, Reply to the 
list, Reply to the list.

If it was the intention of the list manager for people to reply to the 
list then a reply would go to the list, however, a reply goes to the 
poster, not the list.

So who is right ?

Regards,

Jerry Rocteur

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Training in the Middle and Far East

2003-11-04 Thread Jerry Rocteur
What a nasty question / paragraph...

This list is [EMAIL PROTECTED]

Rob, you are completely out of line with that question on this list.

People ask, how do I open a file and other people answer, this is a 
beginner's list..

How many times have I cringed and you as well when we see base 
questions like the one above answered, but this is a beginners list so 
if you've just learned how to open a file, then you want to tell 
someone about it when they ask the question. Boring and not acceptable 
by you but this is a beginner's list.

I don't think this list or Perl for that matter prerequisites Computer 
Science education, my uncle is a bricklayer and likes to program in 
Perl.. Is he not allowed to ask a question on this list ??

The fact that Randall occasionally answers posts means that the list is 
still acceptable, mind you, I miss input from John Krahn who seems to 
have slipped away for a while.. come back John...

If someone, be it from India, Taiwan, Bahrain, Chicago, on this list 
asks how to add 1 to 1 in Perl, someone will answer, this is a 
beginner's list. Mind you, no one from Belgium would ever ask a 
question like this cause we're too smart. Crap

I think it is encouraging that we have so many posts from middle and 
eastern countries, I'm just sad that so many of those posts relate to 
Windows type Operating Systems.. That pisses me off more than anything 
else..

Personally, I'd love to see a UNIX/LINUX only Perl beginner's list, I 
don't use Windows and I hate Windows posts, I wish they would all blow 
up and go away.. Be it from India, Taiwan, Bahrain or Chicago.

Long live Perl..

Jerry

On Tuesday, Nov 4, 2003, at 21:10 Europe/Brussels, Rob Dixon wrote:

To all.

I wonder if any subscriber from the middle and far eastern
countries can explain what training and IT experience people
like them are likely to have had? It seems to me that a
disproportionate number of posted questions coming from that
region would be resolved better by a proper grounding in
Computer Science?
Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: command-line

2003-11-02 Thread Jerry Rocteur
On Saturday, Nov 1, 2003, at 18:40 Europe/Brussels, Jeff Westman wrote:

SilverFox <[EMAIL PROTECTED]> wrote:
hey guys, i'm trying to grep some data from a log file and getting the
following error. Any ideas???
[EMAIL PROTECTED] perl -e 'grep \"Eliminating movie\" update.log |awk 
{'print
\$5'}';

Can't find string terminator '"' anywhere before EOF at -e line 1.
You're mixing perl up with shell!

Maybe what you are trying to do is:
  grep "Eliminating movie" update.log | awk '{ print $5'}'
Or if you want this in perl, then you certainly would not be using 
'grep' and
not make a SYSTEM call to awk.

???

 perl -lane 'print $F[4] if /Eliminating movie/' update.log

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: script to test a file.

2003-10-29 Thread Jerry Rocteur
On Wednesday, Oct 29, 2003, at 19:43 Europe/Brussels, Wiggins d Anconia 
wrote:



Rick Bragg wrote:
Hi,

I want to write a script that will test the contents of a file.

The file being tested will pass only if it contains nothing more
than an
ip address on one line.  Does anyone have a sample of a simple regex 
to
accomplish this?
/\d+\.\d+\.\d+\.\d+\n?/s

Beware of insufficient regexes in regex clothing.  The above will
certainly find one or more digits followed by a dot, followed by one or
more digits followed by a dot, etc.  But it does *NOT* match an IP
address...
/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/

Is at least closer, but it is still not sufficient, as IP addresses are
bounded, I believe, at 255 so 336.47.894.0, will match the above, but 
is
not a valid IP address.

How strict do you need to be, how sure are you about the data in the 
files?

Doing it with plain regexp won't work in one go, you could put the 
above between (),(),() and check with $1,$2,$3 etc that you don't have 
an 894..

However, you could also use Regexp::Common

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Psh

2003-10-04 Thread Jerry Rocteur
Hi,

I started to read "Perl Objects References & Modules" and I thought, I 
better upgrade my Perl modules to make sure I've got the latest in case 
the book uses something that I may have that is outdated,  so I fired 
up cpan and ran r for   reinstall recommendations and updated my 
modules.. BTW, quite a pain having to upgrade everything manually, pity 
there isn't an automatic way (I have to do this on my Linux boxes and 
my Mac OSX machines, takes ages.. ) anyway, that's another story.

In doing so I came upon psh so I thought I'd check it out..

Very interesting, I can't remember ever installing Psh but I can't 
remember ever using it either..

Anyway not having used it before I thought I'd try it out but what a 
bazar

Do any of you actually use this as a shell. does it replace the Korn 
shell ?

I'm a diehard Korn shell user and even though I've contemplated bash as 
our Solaris boxes at work only have Ksh 88... I always go back to Korn, 
even on Mac OS X, can't stand tcsh..

Anyway, I'm just interested in your views.. Off list if you think this 
is OT .. I must admit, I can't remember anyone talking about Psh on 
this list..

I'm willing to try anything once (except for Rap music) so I'm 
interested in knowing if there are advantages to using the Psh and your 
views..

TIA,

Jerry

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


perldoc

2003-09-20 Thread Jerry Rocteur
Hi,

How do you guys always know what perldoc option to give to find info.. 
John knows them all backwards but Is there some kind of index or is it 
just experience and if it is experience then it is useless to those 
learning... ??

Sometimes I spend ages and still can't find what I'm looking for..

I'm looking for regular expression, how do I know that it is perlre 

Is there a
 perldoc --find 'regular expression' or something like that ?
Or do we do find / -type f -exec egrep -il 'regular expression' {} \;

Sorry, find2perl / -type f -exec egrep -il 'regular expression' ' {} \;

;-))

Jerry

On Friday, Sep 19, 2003, at 22:10 Europe/Brussels, John W. Krahn wrote:

Dumitru Orza wrote:
Hello all,
Hello,

is there any way to assign names of directories to a list ?
opendir DIR, '.' or die "Cannot open the current directory: $!";
my @dirs = grep -d, readdir DIR;
closedir DIR;

Ideea is to check the existance of some directories and not create 
them again.
perldoc -f -d

John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Conceptual -- Spam stopper script

2003-09-17 Thread Jerry Rocteur
Thanks Guys...

Perhaps one day the SMTP protocol will be rewritten to perform checks 
on the sender, perhaps one day .

Thanks for all your thoughts..

Jerry

On Wednesday, Sep 17, 2003, at 11:58 Europe/Brussels, zsdc wrote:

Hanson, Rob wrote:

You will probably run into a few issues.  First you need to fetch the 
MX
record for the domain before you can even connect.  After that you 
could use
the SMTP verify user command to see if the user exists,
...or just use Email::Valid module.

but I think you
might find that many SMTP servers will not give you a reliable 
answer.  I
think AOL, for example, will always tell you that the user exists (I 
may be
wrong though).
Basicaly you cannot know for sure if any given email address is valid. 
You'd have to send an actual email, wait some time for bounces, and 
even then you wouldn't be sure. This is why websites requiring email 
address often send password in email during the registration (which is 
completely insecure but makes sure the email is valid).

I think you might be better off with Spam Assassin, or using an ISP 
that
uses it.
I agree.

On the other hand, it can't hurt to try doing it yourself.
If we don't count the DOSing and lots of false positives then of 
course it can't hurt.

--
ZSDC Perl and Systems Security Consulting


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


OT: Conceptual -- Spam stopper script

2003-09-16 Thread Jerry Rocteur
Hi,

I've been analyzing my SPAM by replying to it lately and find that MOST  
email addresses where the SPAM originates do not exist.. Nothing new  
here..

What I'd like to do is to write a script that accesses my pop mail,  
gets the From: address, verifies it and if it is a valid address,  
accepts the mail, otherwise, removes  it..

Is this feasible or plain wishful thinking ???

I've written perl scripts to  handle sending mail and to access pop  
mail but I'm not sure of being able to do the above ???

I realize this is a bit OFF topic but SPAM is getting to me ;-((

Thanks for your thoughts,

Jerry Rocteur.

Italy did it first...
http://www.rocteur.cc/geeklog/public_html/ 
article.php?story=20030914164349518

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Case conversions

2003-08-15 Thread Jerry Rocteur
I've just used Elias' idea to change a file's content...

Where file name is word:

perl -i -p  -e 's/(.)(.*)/$1\L$2/' word

On Friday, Aug 15, 2003, at 23:29 Europe/Brussels, Elias Assmann wrote:

On Fri, Aug 15, 2003 at 02:20:19PM -0700, Scott Taylor wrote:
Any one have or know of a function to convert ugly "NAME, USER" to 
"User
Name"?
$ perl -le '$_ = "NAME"; s/(.)(.*)/$1\L$2/; print'
Name
The function to convert a string to lower case is "lc".

HTH,

Elias

--
If you take the fact that a cat always falls on his feets and a toast
always falls on the buttered side, what happens when you tie a toast
on the back of a cat and you throw him out the window?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Can LWP::Simple tranfer image urls?

2003-06-22 Thread Jerry Rocteur
Finally, some usefull stuff in Perl ;-))

On Saturday, Jun 21, 2003, at 18:52 Europe/Brussels, Randal L. Schwartz 
wrote:

The code for 2001, 2002, and 2003 is in the thread starting at:

  


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: More advanced list

2003-01-05 Thread Jerry Rocteur
Hi,

Thanks.. I would not unsubscribe from this list, it is great and it has 
its place, there's quite a bit of advanced stuff on this list and 
whilst Randal subscribes to it, I'll stay subscribed ;-))

I was just interested in what other Perl lists you more advanced guys 
also subscribed to that's all..

Thanks again!

Jerry

It is just that I did want to have a list that was not made for 
beginners
On Sunday, Jan 5, 2003, at 00:49 Europe/Brussels, Timothy Johnson wrote:


Check out http://lists.perl.org.  There are quite a few lists, and 
probably
a few of them are close to what you want, although it seems there 
might be
quite a large gap in the expected comptetency level.  In the meantime, 
you
can always post any moderately advanced questions here, and someone can
probably help you, but if you're looking to filter out the beginner
questions then I would look at one of the more advanced lists.

-Original Message-
From: Jerry Rocteur [mailto:[EMAIL PROTECTED]]
Sent: Saturday, January 04, 2003 3:43 PM
To: [EMAIL PROTECTED]
Subject: More advanced list


Hi,

I'm looking for a Perl list a bit more advanced that this one, you
know, not beginners questions..

I love this list and I'm learning a lot from it but I'm wondering if
there is another list with less "hello world" or Visual basic is better
than Perl type comments, preferably NO WINDOWS but I guess
unfortunately that is impossible ??

Any ideas ???

Thanks guys,

Jerry




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




More advanced list

2003-01-04 Thread Jerry Rocteur
Hi,

I'm looking for a Perl list a bit more advanced that this one, you 
know, not beginners questions..

I love this list and I'm learning a lot from it but I'm wondering if 
there is another list with less "hello world" or Visual basic is better 
than Perl type comments, preferably NO WINDOWS but I guess 
unfortunately that is impossible ??

Any ideas ???

Thanks guys,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Stepping back into the last Century in 2003 - Curses

2003-01-01 Thread Jerry Rocteur
# Platform, SuSE Linux 8.1 and Mac OS X 10.2.3 both running Perl 5.8
#
# Destination platform Solaris 8
#

Hi,

I'd like to write some menus in Perl..

I looked at the FAQ and saw that perlmenu is recommended, so I 
installed it.

It does not tell you it needs curses but when you first run it, it 
yells that Curses.pm is not installed.. (Can't locate Curses.pm in @INC 
...)

So this is where I stepped back to circa 1988.. I tried to install 
Curses.pm... OUCH.

I've tried both of these operations on Mac OSX and Suse Linux and I get 
the same or similar results.

I've read the INSTALL and linked the hints files to c-config.h played 
around and played around and I always get similar results..


CursesFun.c: In function `XS_Curses_getwin':
CursesFun.c:3472: warning: initialization from incompatible pointer type
make: *** [Curses.o] Error 1

This is OBVIOUSLY NOT the way to go in 2003, having to play around 
header files and libraries to get something working, I had less work to 
do upgrading Mac OS X to perl 5.8 than to get this * working.

So, my question is, what do you guys use for menus that works in Perl, 
the destination system once it is developed will be Solaris 8.

I would be grateful for workable solutions, note that I don't want GUI 
stuff, just simple stuff that will work with ssh/Keaterm in the future.

Thanks very much,

Jerry Rocteur.
Back to the Future


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: creating a mysql table with perl

2002-12-25 Thread Jerry Rocteur
Hi Tricia,

I just did:

	 perldoc -q data base

And found:

Found in /System/Library/Perl/pods/perlfaq8.pod
   How do I use an SQL database?

   There are a number of excellent interfaces to SQL
   databases.  See the DBD::* modules available from
   http://www.perl.com/CPAN/modules/DBD .  A lot of informa-
   tion on this can be found at http://www.symbol-
   stone.org/technology/perl/DBI/

Merry Christmas,

Jerry

On Wednesday, Dec 25, 2002, at 04:38 Europe/Brussels, Patricia Hinman 
wrote:

Hi everyone,

I know it's Christmas eve,  and I should be enjoying
myself,  but that's about all that's here tonight,
(myself).

So I thought I would jump into mysql and learn the
basics.

I've found lot's of info for people who enter data on
the command line, but I would like to use a script to
create and manipulate tables.

Does anyone know of a good tutorial that uses perl
with mysql?

Thanks
Tricia
[EMAIL PROTECTED]

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Mail::Sendmail & attachments

2002-12-15 Thread Jerry Rocteur
From man Mail::Sendmail

  Look at http://alma.ch/perl/Mail-Sendmail-FAQ.htm for additional info 
(CGI, examples of sending attachments,
   HTML mail etc...)

Jerry

On Sunday, Dec 15, 2002, at 12:31 Europe/Brussels, Adam Stuckey wrote:

Hello everyone,

Does anyone know of a way to send attachments via the module 
Mail::Sendmail?

Thanks.

Adam Stuckey


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: One liner brain curler (for me ;-)

2002-12-15 Thread Jerry Rocteur

On Sunday, Dec 15, 2002, at 13:00 Europe/Brussels, John W. Krahn wrote:

perl -e 'for (@ARGV) {rename $_,uc($_) unless -e "uc($_)"; } ' *
What is wrong with it ???


subs/functions don't interpolate in quoted strings.

perl -e'-e uc||rename($_,uc)for@ARGV' *



You're incredible John.. You must be Larry's brother ;-))

Thanks very much..

If anyone has one liners you think I could use, send them to me, I'm  
composing a list from the ones I've found, I've not tried them all yet  
but I'm working my way through them:

	http://www.rocteur.cc/geeklog/public_html/ 
article.php?story=20020118223020446

TIA,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



One liner brain curler (for me ;-)

2002-12-15 Thread Jerry Rocteur
Hi,

After you guys sent me all those wonderful links yesterday I've become 
a one liner freak ;-))

This one is driving me crazy, no matter how I do the unless, it always 
ignores it and overwrites an existing file.

I've been struggling with it for hours and have tried all combinations 
but just can't

perl -e 'for (@ARGV) {rename $_,uc($_) unless -e "uc($_)"; } ' *

What is wrong with it ???

Thanks,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: UNIX Admin and Shell Perl resources

2002-12-14 Thread Jerry Rocteur
Thanks to all of you who answered.

I had a lot of fun reading though the links and information sent to me!!

I appreciate it!!

Jerry

Jerry Rocteur wrote:


Hi,
I like this list very much and I think it is very helpful!

In my work and at home I spend most of my time at a UNIX prompt, either
Linux, Mac OS X, Solaris etc.

I know the Korn shell very well and I can get by with Perl but I find
myself always doing stuff in ksh instead of Perl. I've recently started
using Perl one liners to replace simple sed, grep and awk stuff but at
the end of the day, when I have do do something more complicated but
quickly, I hack out a ksh script instead of doing it in Perl!

I'd like to improve my Perl UNIX admin skills so that I could one day
do most of it in Perl and so I'm looking for Perl UNIX Admin resources.

Do any of you know a mailing list like this one that sticks to pure
UNIX admin or just pure UNIX stuff.

What about resources, any web sites concentrate on Perl for Unix Admins
? Or any other suggestions!



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




UNIX Admin and Shell Perl resources

2002-12-13 Thread Jerry Rocteur
Hi,

I like this list very much and I think it is very helpful!

In my work and at home I spend most of my time at a UNIX prompt, either 
Linux, Mac OS X, Solaris etc.

I know the Korn shell very well and I can get by with Perl but I find 
myself always doing stuff in ksh instead of Perl. I've recently started 
using Perl one liners to replace simple sed, grep and awk stuff but at 
the end of the day, when I have do do something more complicated but 
quickly, I hack out a ksh script instead of doing it in Perl!

I'd like to improve my Perl UNIX admin skills so that I could one day 
do most of it in Perl and so I'm looking for Perl UNIX Admin resources.

Do any of you know a mailing list like this one that sticks to pure 
UNIX admin or just pure UNIX stuff.

What about resources, any web sites concentrate on Perl for Unix Admins 
? Or any other suggestions!

Thanks in advance,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: GNU grep -C in Perl

2002-12-10 Thread Jerry Rocteur
Hi,

Reading further in the archives to this list I got an idea: (thanks to 
John W. Krahn)

#!/usr/bin/perl
$pattern = shift(@ARGV);
while (<>) {
if ( /$pattern/i ){
print $reml;
print $_;
$_ = <>;
print "$_\n";
}
$reml = $_;
}

That is certainly much quicker than the way I was doing it before..

I'd still like to see if there is a cleaner way though.

Also, to make it more flexible, perhaps print more than one line before 
and more than one line after.

TIA,

Jerry

On Tuesday, Dec 10, 2002, at 21:22 Europe/Brussels, Jerry Rocteur wrote:

Hi,

Anyone know how to write a grep -C in Perl ?

You know, I want to search for a string/regexp in a file and I want to 
print the line before and the line after the search string.

I've tried a couple of ways and it takes a really long time, I load 
the file in memory, seach for the string, extract the line number of 
the string $. subtract one and add one and print the three lines but 
this can take a very long time.. I don't have grep -C on the system I 
want to do this.

I've looked at perldoc and the list archives and can't fing any help..

Thanks in advance,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




GNU grep -C in Perl

2002-12-10 Thread Jerry Rocteur
Hi,

Anyone know how to write a grep -C in Perl ?

You know, I want to search for a string/regexp in a file and I want to 
print the line before and the line after the search string.

I've tried a couple of ways and it takes a really long time, I load the 
file in memory, seach for the string, extract the line number of the 
string $. subtract one and add one and print the three lines but this 
can take a very long time.. I don't have grep -C on the system I want 
to do this.

I've looked at perldoc and the list archives and can't fing any help..

Thanks in advance,

Jerry


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]