Re: A little Object Question

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, Tom Allison said: I have two objects. [snip] I have another object in a lib path that looks like: package HIP; use strict; use warnings; use lib '/home/tallison/lib'; use strict; use HIP; and none of the package functions are visible. I call these methods as functions and no

setting a user passwd

2005-07-21 Thread Victor Pezo
Hi, I am developing a program that sets passwd for any user but i dont want the operator sets the passwd. I want to give it as a result of a function [EMAIL PROTECTED] victor]$ perl passwd.pl victor1 #!/usr/bin/perl $usuario=$ARGV[0]; $passwd="PASSWDGENERATEBYOTHERFUNCTION" `sudo /usr/sbin/user

A little Object Question

2005-07-21 Thread Tom Allison
I have two objects. One object is in ~/ and starts like: package IMAP; @ISA=qw(Mail::IMAPClient); use strict; use warnings; use Mail::IMAPClient; --- I can use it in my imap.t code with a simple use IMAP; and all the methods are visible. I call these methods as Object methods. I have anoth

Re: slices of hashes

2005-07-21 Thread Gerard Robin
On Thu, Jul 21, 2005 at 04:04:36PM -0400 Scott R. Godin wrote: > Gerard Robin wrote: > >Hello, > >the slices of hashes work strangely ... > > > > >PS > >if I write: > >@h3{"Mamadoo".."Lulu"} = (30, 40, 50 ); > >the script hangs (no error is displayed) > > > > yes because that's not a hash slice t

Re: Problems creating a simple variable

2005-07-21 Thread JupiterHost.Net
Dave Adams wrote: I want to create a variable, to be used for other stuff, using today's date. Can anyone help me with the second last line? sure :) my $currentdate = '20050721'; You don't explain what you are trying to get as most of us can't read your mind or

Re: to () or not to (), that is the question.

2005-07-21 Thread Bryan R Harris
Great response, by the way, Jeff -- I wish I'd read this 3 years ago... - Bryan > On Jul 21, Brent Clark said: > >> I have the following code: >> >> ($fileName) = ($_ =~ /regexcode/o); >> >> Which gives me the correct data. > >> But if I make it like so (note the () missing around the var

Re: Problems creating a simple variable

2005-07-21 Thread dave.w.turner
Huh? What do you want it to be? On 7/21/05, Dave Adams <[EMAIL PROTECTED]> wrote: > I want to create a variable, to be used for other stuff, using today's date. > > Can anyone help me with the second last line? > > use Time::localtime; > my $tm = localtime; > printf("The current date is > %04d%

Re: Problems creating a simple variable

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, Dave Adams said: I want to create a variable, to be used for other stuff, using today's date. And what do you want it to look like? The MMDD format you have printing? use Time::localtime; my $tm = localtime; printf("The current date is %04d%02d%02d\n",$tm->year+1900,($tm->m

Re: slices of hashes

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, Gerard Robin said: my %h1 = (a => 1, b => 2, c => 3, d => 4, e => 5, f => 6); [snip] print " ", map{ $_." " } @h1{'b'..'e'}; [snip] @h1{'b'..'e'} = (20, 30, 40, 50); print " ", map{ $_." " } @h1{'b'..'e'}; What do you think 'b'..'e' is producing? It's producing the list ('b',

Re: Problems creating a simple variable

2005-07-21 Thread jm
not sure how you would work your version, but here is what i use all the time, maybe it will be easier for you as well... my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime; my $am_pm = $hour > 11 ? " PM" : " AM"; $year += 1900; $mon += 1; $sec = "0" . $sec if $sec < 10;

Re: code improvement using LABELS within subroutines????

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, [EMAIL PROTECTED] said: ok thanks but that does not really help. Sorry. your right about finger(), but based on my code I want to execute a certain block label if ( mary) finger (mary) if (jim) finger(jim) Oh, then in that case: finger($user); # ... sub finger { my $w

How to use % in MySQL SQL statement from Perl?

2005-07-21 Thread Siegfried Heintze
The following code works with perl/MySQL. If I comment the second line, however, it does not work. No error messages and no results. If I use the MySQL Enterprise console and type in my first SELECT statement that includes the LIKE clause, it works. I'm stumped. There must be something strange w

Re: slices of hashes

2005-07-21 Thread Scott R. Godin
Gerard Robin wrote: Hello, the slices of hashes work strangely ... PS if I write: @h3{"Mamadoo".."Lulu"} = (30, 40, 50 ); the script hangs (no error is displayed) yes because that's not a hash slice there: what happens when you do these: ? perl -wle 'print "Mamadoo","Lulu"' perl -wle 'pr

Problems creating a simple variable

2005-07-21 Thread Dave Adams
I want to create a variable, to be used for other stuff, using today's date. Can anyone help me with the second last line? use Time::localtime; my $tm = localtime; printf("The current date is %04d%02d%02d\n",$tm->year+1900,($tm->mon)+1, $tm->mday); my $currentdate = ?? print ($currentdate);

Re-Install CPANPLUS?

2005-07-21 Thread Will
Stupid Move: I deleted everything in ~/.cpanplus/5.8.6/build/ The Problem: when I use CPANPLUS to install Bundle::Catalyst::Everything I get a big long error message. History: I had previously tried to install B::C::E, then the power went out during the install... I tried to install aga

slices of hashes

2005-07-21 Thread Gerard Robin
Hello, the slices of hashes work strangely ... The parts 1, 2 and 4 work fine; but the part 3 doesn't do what I expect. What is wrong in what I do in part 3 ? #!/usr/bin/perl #slice3.pl use warnings; use strict; # 1 my %h1 = (a => 1, b => 2, c => 3, d => 4, e => 5, f => 6); print sort {$a <=>

Re: code improvement using LABELS within subroutines????

2005-07-21 Thread DBSMITH
ok thanks but that does not really help. Sorry. your right about finger(), but based on my code I want to execute a certain block label if ( mary) finger (mary) if (jim) finger(jim) or if (mary) finger(goto mary) if (jim) finger(goto jim) Any other ideas to avoid the same system call 3 times

Re: code improvement using LABELS within subroutines????

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, [EMAIL PROTECTED] said: I am wanting to improve my code b/c I am making 3 identical system calls. So I thought a subroutine with that one call and LABELS for each condition would improve it. sub finger { open (GPG, "gpg --fingerprint |") or die "unable to open pipe sys call + (1).

code improvement using LABELS within subroutines????

2005-07-21 Thread DBSMITH
All, I am wanting to improve my code b/c I am making 3 identical system calls. So I thought a subroutine with that one call and LABELS for each condition would improve it. Is this possible b/c I am getting errors stating cannot find FPR.

How to search within a large number of programs for a subset of variables

2005-07-21 Thread Wagner, David --- Senior Programmer Analyst --- WGO
I need to see what other variables I need to change within a program for vraibles I have changed within copylibs for a set of cobol programs. I can handle finding all the given copylibs within a program. If none of the copylibs I have made changes for, then I can get the next pr

Re: Hash reference structure

2005-07-21 Thread Scott R. Godin
Jan Eden wrote: Hi, I need to store a list of month names into a hash structure such that: $self->{monate}->{1}->{bezeichnung} = 'Januar' $self->{monate}->{2}->{bezeichnung} = 'Februar' etc. Until now, I have used the rather clumsy: @month_hash{1..12} = ("Januar", "Februar", "März", "April",

Re: convert array pair to hash

2005-07-21 Thread Scott R. Godin
Wiggins d'Anconia wrote: Scott R. Godin wrote: On Jul 19, 2005, at 5:19 PM, Wiggins d'Anconia wrote: Close. You want a hash slice. @[EMAIL PROTECTED] = @vals; A marvelously Perlish construct. basically it's shorthand for the more obvious and well documented @{$reference} notation. [snip]

RE: Hash reference structure

2005-07-21 Thread Jan Eden
Thanks, Xavier and Bob, that looks much better. Cheers, Jan Bob Showalter wrote on 21.07.2005: >Jan Eden wrote: >> Hi, >> >> I need to store a list of month names into a hash structure such that: >> >> $self->{monate}->{1}->{bezeichnung} = 'Januar' >> $self->{monate}->{2}->{bezeichnung} = 'F

RE: Hash reference structure

2005-07-21 Thread Bob Showalter
Bob Showalter wrote: > >$self->{monate}{$_}{bezeichnung} = $month_hash{$_} for 1..12; > That could also be 'for keys %month_hash' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Hash reference structure

2005-07-21 Thread Bob Showalter
Jan Eden wrote: > Hi, > > I need to store a list of month names into a hash structure such that: > > $self->{monate}->{1}->{bezeichnung} = 'Januar' > $self->{monate}->{2}->{bezeichnung} = 'Februar' > etc. > > Until now, I have used the rather clumsy: > > @month_hash{1..12} = ("Januar", "Februar

Re: Hash reference structure

2005-07-21 Thread Xavier Noria
On Jul 21, 2005, at 17:21, Jan Eden wrote: Hi, I need to store a list of month names into a hash structure such that: $self->{monate}->{1}->{bezeichnung} = 'Januar' $self->{monate}->{2}->{bezeichnung} = 'Februar' etc. Until now, I have used the rather clumsy: @month_hash{1..12} = ("Januar",

Hash reference structure

2005-07-21 Thread Jan Eden
Hi, I need to store a list of month names into a hash structure such that: $self->{monate}->{1}->{bezeichnung} = 'Januar' $self->{monate}->{2}->{bezeichnung} = 'Februar' etc. Until now, I have used the rather clumsy: @month_hash{1..12} = ("Januar", "Februar", "März", "April", "Mai", "Juni", "J

Re: using htpasswd from perl script

2005-07-21 Thread JupiterHost.Net
Graeme McLaren wrote: Guys, thank you for your replies! using .htaccess from the command line: bash-2.03# /usr/local/apache/bin/htpasswd /path/to/auth/file/auth_file username New password: Re-type new password: Adding password for user username How would I do this using that module? From

Re: get value (name of file)

2005-07-21 Thread bright true
Hello , i think this would be a good way #!/usr/bin/perl -w use strict; my $file = 'data.csv'; open(FILE,$file); while(my $line = ){ my @wanted = split(/\|/,$line); print $wanted[0],"\n"; } close(FILE); On 7/21/05, Rob Coops <[EMAIL PROTECTED]> wrote: > > Try the following (this is just a sh

Re: to () or not to (), that is the question.

2005-07-21 Thread Brent Clark
Jeff 'japhy' Pinyan wrote: The difference is the context. A pattern match returns different values depending on whether it was called in scalar context or list context. In scalar context, a pattern match returns whether or not it was able to match. In list context, the pattern match returns

RE: to () or not to (), that is the question.

2005-07-21 Thread Bob Showalter
Brent Clark wrote: > Hi list > > Would someone be so kind as to share some light on this for me. > > I have the following code: > > ($fileName) = ($_ =~ /regexcode/o); > > Which gives me the correct data. > > But if I make it like so (note the () missing around the variable): > > $fileName =

Re: to () or not to (), that is the question.

2005-07-21 Thread Jeff 'japhy' Pinyan
On Jul 21, Brent Clark said: I have the following code: ($fileName) = ($_ =~ /regexcode/o); Which gives me the correct data. But if I make it like so (note the () missing around the variable): $fileName = ($_ =~ /regexcode/o); Whats the difference. The difference is the context. A patt

Re: to () or not to (), that is the question.

2005-07-21 Thread Brent Clark
Sorry I for got to add. In the second statement I only get a "1" Thanks Brent -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

to () or not to (), that is the question.

2005-07-21 Thread Brent Clark
Hi list Would someone be so kind as to share some light on this for me. I have the following code: ($fileName) = ($_ =~ /regexcode/o); Which gives me the correct data. But if I make it like so (note the () missing around the variable): $fileName = ($_ =~ /regexcode/o); Whats the difference.

Perl : Hands on Project : Needed : Help Me

2005-07-21 Thread atul ashpalia
Hi All, I am looking out for some web based perl application project to do. can anyone give me some good idea, what kind of web based perl project i can do to get hand-on on perl. thanks in advance, regards, Atul Ashpalia Sta

Re: get value (name of file)

2005-07-21 Thread John W. Krahn
Tom Allison wrote: > > Also, is there any reason NOT to end the regex with /o to improve > performance? perldoc -q '/o' Found in /usr/lib/perl5/5.8.6/pod/perlfaq6.pod What is "/o" really for? Using a variable in a regular expression match forces a re‐evaluation (and perhaps

Re: cool tricks for inserting element into array?

2005-07-21 Thread John W. Krahn
Tom Allison wrote: > John W. Krahn wrote: > >> for ( my $i = @tmp; --$i; ) { >> splice @tmp, $i, 0, '|'; >> } > > How does this fare for large arrays? According to my tests it does poorly on large arrays. John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-ma

Re: get value (name of file)

2005-07-21 Thread Tom Allison
Thomas Bätzler wrote: Brent Clark <[EMAIL PROTECTED]> asked: I have a CSV file and on every line, I have a line like so: lts.dat|somedata lts001.dat|somemoredata Generally, you can capture data from a RE with a pair of brackets around the relevant expression, and the data is then availabl

Re: cool tricks for inserting element into array?

2005-07-21 Thread Tom Allison
Bryan R Harris wrote: As a sidenote, are questions like this appropriate for the list? I really don't *need* help with this, I was just hoping to expand my personal toolbox with a better way to do something. Every time John, Wiggins, Luke, Bob, Jeff, etc. respond to my emails I know I'm going

RE: get value (name of file)

2005-07-21 Thread Thomas Bätzler
Brent Clark <[EMAIL PROTECTED]> asked: > I have a CSV file and on every line, I have a line like so: > > lts.dat|somedata > lts001.dat|somemoredata Generally, you can capture data from a RE with a pair of brackets around the relevant expression, and the data is then available in the variables $

Re: get value (name of file)

2005-07-21 Thread Rob Coops
Try the following (this is just a short example) #!/usr/bin/perl -w use strict; # Open the file open (IN, ") { chomp; # Make sure there is no funny stuff at the end (not really needed in this example though) my ($temp) = $_ =~ /^(.*)\|.*$/; ($_ holds the line so we match the stuff we want to

get value (name of file)

2005-07-21 Thread Brent Clark
Hi list I was hoping someone would be so kind as to help me with this. I have a CSV file and on every line, I have a line like so: lts.dat|somedata lts001.dat|somemoredata I basically would like to ONLY get the name of the file before the first pipe. I was thinking that the regex would look

Re: using htpasswd from perl script

2005-07-21 Thread Graeme McLaren
Guys, thank you for your replies! using .htaccess from the command line: bash-2.03# /usr/local/apache/bin/htpasswd /path/to/auth/file/auth_file username New password: Re-type new password: Adding password for user username How would I do this using that module? From what I can see there does