Re: Can't locate CPAN.pm in @INC

2008-02-01 Thread Adriano Ferreira
On Feb 1, 2008 10:47 AM, Pradeep Mishra <[EMAIL PROTECTED]> wrote: > hi all > > I have been trying to install spamassin using ...perl -MCPAN -e shell > which throws an error > > Can't locate CPAN.pm in @INC (@INC contains: > /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi > /usr/lib/perl5/si

Re: Shell qw(mysqldump) and localtime.

2007-09-03 Thread Adriano Ferreira
sing Shell. And unless your script is very small, it's not such a good idea to use it (the Shell core module). > > How could I use this command with the Shell function ? > > [1] : http://perldoc.perl.org/functions/localtime.html > [2] : http://perldoc.perl.org/Shell.h

Re: Logging STDERR and other output

2007-08-30 Thread Adriano Ferreira
On 8/30/07, Beginner <[EMAIL PROTECTED]> wrote: > On 30 Aug 2007 at 6:32, Peter Scott wrote: > > > On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > > > I want all the output plus any error messages to got to a log file. I > > > used the BEGIN block to direct STDERR into the file: > > > > > > B

Re: Logging STDERR and other output

2007-08-30 Thread Adriano Ferreira
On 8/30/07, Peter Scott <[EMAIL PROTECTED]> wrote: > On Thu, 30 Aug 2007 10:32:01 +0100, Beginner wrote: > > I want all the output plus any error messages to got to a log file. I > > used the BEGIN block to direct STDERR into the file: > > > > BEGIN { > > open(STDERR, ">>/usr/local/myreports/

Re: [OT] How do you use Perl?

2007-08-09 Thread Adriano Ferreira
On 8/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello list, > > Just be curious to see how do you guys use Perl for work.Would you be > pleased to give a vote below? > > [a] CGI/Web Development > [b] System Administration > [c] mod_perl -- write Apache handler > [d] write commercial produ

Re: Getting sub routine name as string

2007-08-02 Thread Adriano Ferreira
On 8/2/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: > Brown, Rodrick wrote: > > How can I get the subroutine calling name as a string? > > > > Ie. Sub foo { } I would like to get foo back as a string. > > See `perldoc -f caller` Shawn is absolutely right. The builtin "caller" is what you need

Re: Getting sub routine name as string

2007-08-02 Thread Adriano Ferreira
On 8/2/07, Brown, Rodrick <[EMAIL PROTECTED]> wrote: > > How can I get the subroutine calling name as a string? > > Ie. Sub foo { } I would like to get foo back as a string. Sub::Identify may be useful. http://search.cpan.org/dist/Sub-Identify -- To unsubscribe, e-mail: [EMAIL PROTECTED] For add

Re: **Installing CGI.pm

2007-07-31 Thread Adriano Ferreira
On 7/31/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote: > On Jul 31, 1:31 pm, [EMAIL PROTECTED] (Jackson Samson) wrote: > > I have downloaded the CGI.pm to my Windows machine. Do I need a C > > compiler to build this or can I use ppm install CGI.pm? > > Neither. CGI is a core Perl module.

Re: how do I Append to Perl's @INC array using a variable

2007-07-23 Thread Adriano Ferreira
On 7/23/07, Mr. Shawn H. Corey <[EMAIL PROTECTED]> wrote: Chris Pax wrote: > I know that if i use: use lib "/path/to/dir" works. but when I try to > use a variable it does not work. > here is my code: > @dirs = split /\// , $0; > delete $dirs[-1]; > my $runningDir = join "/",@dirs; > $runningDir.

Re: how to launch perl

2007-07-20 Thread Adriano Ferreira
On 7/20/07, Chas Owens <[EMAIL PROTECTED]> wrote: On 7/20/07, Adriano Ferreira <[EMAIL PROTECTED]> wrote: snip > Just adding to what John already said, it hangs because, when used > without arguments like script file names or " -e 'print qq{Hello, > world\n}

Re: how to launch perl

2007-07-20 Thread Adriano Ferreira
On 7/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hey Guys, I am working on linux (redhat) 1999 version without the xwindows. I have configured my dns server on this linux box and it works fine for my test lab network at home. Apache and sendmail are also working fine without any problem

Re: interpolation of function reference in a here doc

2007-07-02 Thread Adriano Ferreira
On 7/2/07, Gabriel Striewe <[EMAIL PROTECTED]> wrote: Dear List, I wanted to interpolate a function reference in a here doc. The following works fine: my $hello = sub { return "hello world!"; }; printf "hello $s\n", &$hello(); But when I use a heredoc instead,

Re: Leading zeros kept or not kept while increment or decrement

2007-06-12 Thread Adriano Ferreira
ou need this four digit format and a decrement, you'll have to use printf (or sprintf). Cheers, Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: new vs ->new

2007-06-11 Thread Adriano Ferreira
On 6/11/07, Robert Hicks <[EMAIL PROTECTED]> wrote: Dr.Ruud wrote: > "Adriano Ferreira" schreef: > >> Definitely go with >> my $test = Some::Module->new; > > or even with: >my $test = Some::Module::->new(); > While I am sure that will w

Re: Run a block of sql commands using 'here document'

2007-06-08 Thread Adriano Ferreira
On 6/8/07, Martin Barth <[EMAIL PROTECTED]> wrote: Hi, > I know that using 'Here Documents', we can output multiple lines. But is it > possible to run a couple of commands? > > $s = qx [sqlplus user/[EMAIL PROTECTED] < select 2 from DUAL; > exit > ENDOFSQL]; what do you think about that: open(

Re: new vs ->new

2007-06-08 Thread Adriano Ferreira
On 6/8/07, Robert Hicks <[EMAIL PROTECTED]> wrote: I see some modules that call "new" like: my $test = new Some::Module; and some like: my $test = Some::Module->new; Is there a difference and what is the "recommended" way? Definitely go with my $test = Some::Module->new; The indirect obje

Re: Exporter query

2007-06-06 Thread Adriano Ferreira
ort; # if the Calculator package has an import sub } The &add sub is exported by the calc package, which inherited the import from Exporter to get these exporting abilities. But this import was never called. require Calculator; calc->import; would work. But what you probably wan

Re: Convert german umlaut to ascii

2007-05-22 Thread Adriano Ferreira
gua-DE-ASCII/ I learned it existed in the PerlMonks thread "RFC: How to unaccent text?" http://www.perlmonks.org/?node_id=609319 when [salva] made this comment http://www.perlmonks.org/?node_id=609332 Regards, Adriano Ferreira Thanks Andreas -- To unsubscribe, e-mail: [EMAI

Re: Redirecting STDOUT & STDERR

2007-05-07 Thread Adriano Ferreira
eter could not detect by syntactical means that they will be used again. (2) As you're duping, I think you may close the handles explicitly after the restoration of STDOUT and STDERR. close OLDOUT; close OLDERR; In this case, Perl would see a second use of these handles and will not co

Re: Perl versus other scripting language

2007-03-30 Thread Adriano Ferreira
s of Lua developers on Perl or for a Lua mailing list for itself. Anyway, lua-l is the official mailing list for this language: http://www.lua.org/lua-l.html (Homepage) http://bazar2.conectiva.com.br/mailman/listinfo/lua (to join - via Mailman interface) Adriano Ferreira Cheers, Rob -- To uns

Re: what does a lone percent sign mean?

2007-03-06 Thread Adriano Ferreira
On 3/6/07, Tony Heal <[EMAIL PROTECTED]> wrote: I am trying to determine how this does what it does. sub IsLeapYear { my $year = shift; return 0 if $year % 4; return 1 if $year % 100; return 0 if $year % 400; return 1; } The binary operator % is the modulo or remainder

Re: slurp hash from file

2007-02-27 Thread Adriano Ferreira
On 2/27/07, Jorge Almeida <[EMAIL PROTECTED]> wrote: I want to define a hash reference like this: my $h={ a => 'a', b => 'aa &&\ bbb', }; (Note the string containing escaped newlines.) Now, the point is that I have the block a => 'a',

Re: converting to mixed case

2007-02-26 Thread Adriano Ferreira
On 2/26/07, jm <[EMAIL PROTECTED]> wrote: is there a function, module, script, etc. that converts all uppercase to proper mixed case. this particular need is for an address list that is all uppercase Doing it blindly, can be easily achieved with regexes: $address =~ s/(\w)(\w*)/\u$1\L$2/g; w

Re: BInding operator fails

2007-02-26 Thread Adriano Ferreira
On 2/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Thank you both. I am trying to find out why "!~" operator fails. It is due to the whitespaces. but I am using "six" to ignore spaces. It has nothing to do with whitespaces. As Tom said: On 2/26/07, Tom Phoenix <[EMAIL PROTECTED]> w

Re: BInding operator fails

2007-02-26 Thread Adriano Ferreira
On 2/26/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: All, Hi. I have a problem with the below code. I have two strings, $rdns and $result1. I want to make sure $result 1 is NOT part of $rdns. But the below fails...thus instead of printing the else part of the if-else-loop. It print t

Re: concatenation

2007-02-12 Thread Adriano Ferreira
On 2/12/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote: Hi All, I need to concatenate specific string for each element in the array. I tried in the following way with the help of join operator. foreach (@mail) { my $str1=$_; $str1=$str1 . "@abc.com"; "@abc.com" is an interpolating strin

Re: Extract user from email address

2007-02-08 Thread Adriano Ferreira
ou see? On an unrelated note, will the regexes that I use for ids-tripwire and tripwire work as they are or do I need to put the '@domain.com' portion in too? The domain will never change and I only need to worry about those two addresses outside of the users. Adriano Ferreira wrote: &g

Re: while(1) or redo [was: Re: IPC problem]

2007-02-07 Thread Adriano Ferreira
On 2/7/07, Rob Dixon <[EMAIL PROTECTED]> wrote: Igor Sutton wrote: > Hi fellows, > >> Dave, you wanted to use >> >> while (1) { >> ... >> the code to be repeated >> .. >> } >> > > The above code could be written like this: > > { >... ># the code to be repeated >... >redo; >

Re: how to embed data in perl programs

2007-02-07 Thread Adriano Ferreira
On 2/7/07, Sharan Basappa <[EMAIL PROTECTED]> wrote: Hi Tom, What if I wanted to have multiple embedded (and separate) texts embedded in my program. Are you saying that I can have only one text section and that should have keyword DATA. Actually when I wrote example, I assumed that double unders

Re: Does Minimal Perl works for beginners?

2007-02-02 Thread Adriano Ferreira
is compiled during the compilation of the Perl interpreter itself that implements a useful subset of the language, strong enough to equip the build process with advanced capabilities. This is a tool for the developers of the Perl core and not useful outside this context IIRC. Kind regards, Adrian

Re: Extract user from email address

2007-02-02 Thread Adriano Ferreira
'[EMAIL PROTECTED]'); my $user = $addr->user; # this is "casey" Regards, Adriano Ferreira. Thanks, Mathew -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ -- To unsubscribe, e-mail: [EMAIL PRO

Re: Use of uninitialized value in string eq

2007-01-26 Thread Adriano Ferreira
On 1/26/07, Jen Spinney <[EMAIL PROTECTED]> wrote: Hello list! I apologize in advance for not posting a complete sample script that shows my problem, but I can't isolate it outside of my (rather large) perl application. My problem is that I'm hit with a barrage of warnings that tell me I'm usin

Re: perl modules

2006-12-18 Thread Adriano Ferreira
On 12/18/06, positive mind <[EMAIL PROTECTED]> wrote: In Linux, how do I check if a particular Perl module is installed or not on my system? $ perl -MSome::Module\ 99 -e '' will usually tell you something like $ perl -MYAML\ 99 -e '' YAML version 99 required--this is only version 0.62. BEGIN

Re: my, my...

2006-12-15 Thread Adriano Ferreira
On 12/15/06, Jorge Almeida <[EMAIL PROTECTED]> wrote: On Fri, 15 Dec 2006, Adriano Ferreira wrote: > > More differences will show up if you use packages. The my() variables > will have the scoping from the point they are declared to the end of But they can be redefined wit

Re: my, my...

2006-12-15 Thread Adriano Ferreira
On 12/15/06, John W. Krahn <[EMAIL PROTECTED]> wrote: Jorge Almeida wrote: > I thought I already knew a few things about Perl, but I just found out I > don't: > #!/usr/bin/perl -w > use strict; > use diagnostics; > my $a="27"; > doit(); > sub doit{ > print "$a\n";

Re: declaring a zero size hash

2006-12-12 Thread Adriano Ferreira
On 12/12/06, Helliwell, Kim <[EMAIL PROTECTED]> wrote: I think you need to do: my %loginhash = {}; That's not right. {} is a hash ref, not a hash. It stands for a scalar value. When you do that my %h = {} or, for the same result, my %h = 1; my %h = "abacate"; you end with a hash

Re: declaring a zero size hash

2006-12-12 Thread Adriano Ferreira
On 12/12/06, Dukelow, Don <[EMAIL PROTECTED]> wrote: I'm trying to declare a zero size hash so a sub function can populate it and be see by all other sub's. my %loginHash(); my %loginHash; should be enough. But the "use strict" doesn't like it. It is not "use strict" that does not like i

Re: CYGWIN Uninstall

2006-12-08 Thread Adriano Ferreira
On 12/8/06, Charith Hettige <[EMAIL PROTECTED]> wrote: Hi All, I am having trouble uninstalling the current Cygwin installation. Since there doesn't seem to be an entry in Add/Remove of windows. Please be kind enough to help me with this. This list is not about Cygwin. We may be interested in

Latest Perl in Cygwin is 5.8.7?

2006-12-07 Thread Adriano Ferreira
itory? Anyone has clues about it? Adriano Ferreira -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: no number return

2006-11-30 Thread Adriano Ferreira
On 11/30/06, Chris Parker <[EMAIL PROTECTED]> wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Adriano Ferreira wrote: > On 11/30/06, Chris Parker <[EMAIL PROTECTED]> wrote: >> while(@numbers = <>) { >> >> # Extract widths @width = split("

Re: no number return

2006-11-30 Thread Adriano Ferreira
On 11/30/06, Chris Parker <[EMAIL PROTECTED]> wrote: while(@numbers = <>) { # Extract widths @width = split(" ", $numbers); Here at this piece of code, @numbers and $numbers are different variables. And you never assign anything to $numbers. Probably you want this: while (

Re: Who can help me to explain the reason? about regex `m' modifier.

2006-11-28 Thread Adriano Ferreira
On 11/28/06, flw <[EMAIL PROTECTED]> wrote: Who cabeginnersn help me to explain the reason? $ perl -e '$_="a11\nb22\nc33\n"; print $_, "-"x15, "\n";s/^a.*^b.*/x/m; print' The problem here is that \m allows "^" to match after any newline within the string, but does not change "." which matches

Re: Commenting Perl code

2006-11-28 Thread Adriano Ferreira
a way to deactivate pieces of code which are not ready yet or which have been replaced by something else. Depending on the editor you use and your skills with it, POD may be handier to comment such blocks. Regards, Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: unique hash keys

2006-10-23 Thread Adriano Ferreira
On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: Thank you Adriano, that works nicely after I added: use Memoize::AnyDBM_File; before that I was getting this error: AnyDBM_File doesn't define an EXISTS method at I had not payed much attention to the fact that your code were using

Re: unique hash keys

2006-10-23 Thread Adriano Ferreira
On 10/23/06, Romeo Theriault <[EMAIL PROTECTED]> wrote: This all works fine, but in the last step of the program I am trying to get the program to tell me key's that are unique to only the first hash. No matter what I do it always prints out all of the values in the first hash, not the keys that

Re: why Perl complaints my script

2006-09-28 Thread Adriano Ferreira
that. As Igor has said the first statement in the for is often used for declaring loop variables or, more generally, for loop initialization statements. If you don't have these initialization statements, you may omit it. Regards, Adriano Ferreira -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: temporarily change a function, sort of like doing a local $var;

2006-09-12 Thread Adriano Ferreira
On 9/12/06, JupiterHost.Net <[EMAIL PROTECTED]> wrote: I'm trying to change the behavior of a function (whose use of and call I have no control over) to avoid some nasty behavior in certain circumstances. Its easy enough to redefine it but after the hairy part is done I want to change it back.

Re: perl built in function for mean

2006-09-10 Thread Adriano Ferreira
On 9/10/06, Jen Spinney <[EMAIL PROTECTED]> wrote: On 9/10/06, Dr.Ruud <[EMAIL PROTECTED]> wrote: > my$mean;mean+=$_/@data [EMAIL PROTECTED]; Don't you need another dollar sign? my$mean;$mean+=$_/@data [EMAIL PROTECTED]; Where is Rob to tell Dr. Ruud if one must test the code for him after h

Re: regular expression question

2006-09-07 Thread Adriano Ferreira
od. That was a case of "learning by bad example", that I do not intend to advocate here. I will be more careful in the next posts. Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: How to write an integer to socket

2006-09-06 Thread Adriano Ferreira
On 9/7/06, Adriano Ferreira <[EMAIL PROTECTED]> wrote: On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hi, guys > In a udp socket test routine, I want to write some integers to server in network > order. But unfortunately, my server receive just chars! how can

Re: How to write an integer to socket

2006-09-06 Thread Adriano Ferreira
On 9/6/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hi, guys In a udp socket test routine, I want to write some integers to server in network order. But unfortunately, my server receive just chars! how can I do? Take a look at 'perldoc pack' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: regular expression question

2006-09-06 Thread Adriano Ferreira
On 9/6/06, chen li <[EMAIL PROTECTED]> wrote: I need a regular expression to process some data but get stuck. I wonder if anyone here might have a clue. input: my $line='group A 1 2 3 4';# separated by space results: my @data=("group A ",1,2,3,4); You barely need a regular expression for

Re: arithmetic expression while substituting

2006-09-06 Thread Adriano Ferreira
On 9/6/06, Michael Alipio <[EMAIL PROTECTED]> wrote: I want to adjust the last two digits to less 1: perhaps something like this. s/\d+$/(regexp being lookup minus 1/ s/(\d+)$/$1-1/e is going to work, even though it is convoluted and not robust. For example, '06.00' will become '06.-1' --

Re: Regex not working as expected

2006-09-04 Thread Adriano Ferreira
Chris, I found your solution to work alright, with the exception that you probably don't want to escape | as in (?:http\|ftp\|file) but only (?:http|ftp|file) So that the test script below succeeds: use Test::More tests => 3; { my $url = "http://foo.org/"; $url =~s#>((?:ht

Re: general subroutine question

2006-08-30 Thread Adriano Ferreira
On 8/30/06, Derek B. Smith <[EMAIL PROTECTED]> wrote: Why is it so many people on the list are sarcastic??? Many enjoy being that way. Some enjoy helping people at this list and others, but get tired sometimes and forget they can only ignore what they thought to be a not-so-clear question and

Re: Time::Local let me faint

2006-08-29 Thread Adriano Ferreira
al -le 'print timelocal(0,0,0,31,7,2006)' 1156953600 is getting "31/Aug/2006" which is alright. Regards, Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: number rounding problem

2006-08-28 Thread Adriano Ferreira
'printf "%f", 1000*shift' 64.63 64630.00 But I am not sure you would like %12.12f $ perl -e 'printf "%12.12f", 1000*shift' 64.63 64629.9993 Maybe %12.2f $ perl -e 'printf "%12.2f", 1000*shift' 64.63 64630.00 Regards,

Re: [OT] perldoc typo

2006-08-25 Thread Adriano Ferreira
probably at perlfaq5 - but I could not found a version of Perl with the problem you pointed ("the dash of the arrow missing"). Regards, Adriano Ferreira. On 8/24/06, Klaus Jantzen <[EMAIL PROTECTED]> wrote: I would like to inform whoever feels responsible for perldoc th

Re: is there a path enviroment parameter that can tell perl where to find files?

2006-08-23 Thread Adriano Ferreira
perldoc perlrun or http://perldoc.perl.org/perlrun.html You will probably like the -S switch (for finding your script files via path) and PERL5LIB. Regards, Adriano Ferreira -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http:

Re: Intersection for each pair of arrays

2006-08-23 Thread Adriano Ferreira
>next_combination) { my ($a, $b) = @pair; my ($u, $i) = unisect(@pair); print "(@$a) U (@$b) = (@$u)\n(@$a) A (@$b) = (@$i)\n\n"; } Kind regards, Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAI

Fwd: hello Sir, I have an issue with the case insensitive characters, would you plz help me

2006-08-23 Thread Adriano Ferreira
ones you care about. Like this for (glob "$first.trc.*") { print "FOUND: $_" if /$first.trc.$MACHINE_TYPE/i; } Adriano Ferreira -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: Can't locate object method - weirdness

2006-06-07 Thread Adriano Ferreira
Graeme, (Send your messages to the list beginners@perl.org so that more people can help you out.) I still don't know where your problem is. The files you sent look ok, with some remarks: em_log.pm should contain the statement "package SI::eventmaster::em_log;" rather than "package em_log;

Re: Can't locate object method - weirdness

2006-06-07 Thread Adriano Ferreira
On 6/7/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: Hi there, thanks for your reply, here is my constructor: sub new{ my ($class) = @_; my $self = { _table => undef, _id => undef, # this refers to the column named "pkey_updated_record" in the log table _dbh => u

Re: Can't locate object method - weirdness

2006-06-07 Thread Adriano Ferreira
On 6/7/06, Graeme McLaren <[EMAIL PROTECTED]> wrote: Hi all, I have a weird error: Can't locate object method "dbh" via package "em_log" at /path/log.cgi line 15. line 15 is the second of these two lines: my $log = em_log->new; $log->dbh($dbh); Does your code define a suitable new() ? The b

Re: Search for a Word in a file

2006-06-07 Thread Adriano Ferreira
It seems like I did not read enough of your message to give you a sensible answer to your problem. # write a function to do what the one-liner did, but stopping at the first row sub find_first { my $regex = shift; local @ARGV = @_; while (<>) { retu

Re: Search for a Word in a file

2006-06-07 Thread Adriano Ferreira
This one-liner works a bit like a (Unix) grep: perl -n -e 'print if //' temp.txt and is probably efficient enough for most cases. On 6/7/06, anu p <[EMAIL PROTECTED]> wrote: Hi All, I have a requirement where I need to check if a word exists in a text file and if so, get the whole line of t

Re: ksh in a perl program

2006-06-06 Thread Adriano Ferreira
On 6/6/06, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote: I wanted to include the shell script, abc, as I want to access a variable. The shell script, abc, actually takes a value (val) from the user. I want to use that value (val) in my perl porgram. Is that possible? Perl may take a value from the

Re: ksh in a perl program

2006-06-06 Thread Adriano Ferreira
On 6/6/06, Lakshmi Sailaja <[EMAIL PROTECTED]> wrote: Can I include a korn shell script in a perl program? Not include, but you certainly can execute a shell script from within a Perl program. I have done the following but I get a compilation failed error. abc is the ksh script. -

Re: reading Perl syntax

2006-06-06 Thread Adriano Ferreira
The line below was folded, and $self->{'fookey'} = 'some value here'; #hashref accessible only within Package Foo; the Perl interpreter is seeing within Package Foo; Outputs: Can't locate object method "within" via package "Package" (perhaps you forgot to load "Package"?) at ./myOOP

Re: Accessing page using Mechanize, have to go thr' proxy

2006-06-02 Thread Adriano Ferreira
Adding to what Tom said, if you are behind an annoying authenticating proxy like Squid, you will find that something like this works: $mech->proxy(['http', 'ftp'], 'http://proxy_user:[EMAIL PROTECTED]:/'); Have fun. Adriano. On 6/2/06, Shalaka <[EMAIL PROTECTED]> wrote: I've used the WWW::

Re: problem with whitespace not splitting on split.

2006-04-26 Thread Adriano Ferreira
On 4/26/06, Rance Hall <[EMAIL PROTECTED]> wrote: > @domain = split(' ',$domainlist); This usage of split only splits at spaces. For example, if $domaintlist contains 'a b c', you will get ('a', 'b', 'c'). It has nothing to do with other kinds of spaces. If you meant @domain = split /\s+/, $doma

Re: regarding panic error message.

2006-01-31 Thread Adriano Ferreira
to be fixed when someone got the tuits to do it. Regards, Adriano Ferreira. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
On 1/14/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > Thanks for Adriano.I have tried the way that mentioned by you,and found it's > no use for me. > should the '-F' option have no effect for symlinks maybe? > Well, that way would be easier if it worked. But I think with some extra logic you can d

Re: the 'tail' problem

2006-01-14 Thread Adriano Ferreira
you found it works for symlinks, all you have to do is use > open (TAIL,"tail -F $log|") or die "can't open pipe:$!"; Regards, Adriano Ferreira. On 1/14/06, Jeff Pang <[EMAIL PROTECTED]> wrote: > I have a log file which is a symbol link to the real log

Re: The "@" symbol

2006-01-13 Thread Adriano Ferreira
On 1/13/06, Adriano Ferreira <[EMAIL PROTECTED]> wrote: > It is in core documentation somewhere, even though I could not locate > it right now. Here it is: try C in the section "Regexp Quote-Like Operators", search for the item <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: The "@" symbol

2006-01-13 Thread Adriano Ferreira
A here document (like the one you wrote in your script between "< wrote: > trying to include the following code with the abc.pl script... > > the snippet works in an html/css environment > > print < > > @import url("theta.css"); > @media print { >

Re: How to improve speed of returning value from calling method on an array of objects?

2006-01-06 Thread Adriano Ferreira
On 1/6/06, Sai Tong <[EMAIL PROTECTED]> wrote: > I have an array of many objects and I want to call a method on > each of these objects and the save the returned values into an array: > my @return_values; > foreach my $retrievedObject (@array_of_objects) { > push (@return_values , $retrievedObject

Re: Use of uninitialized value Error

2005-12-30 Thread Adriano Ferreira
On 12/30/05, David Gilden <[EMAIL PROTECTED]> wrote: > In the Script below the line: last if ($num >= 35) > is giving me this error: Use of uninitialized value in int That's not an error, but a warning. You will find that execution goes after this. > How do I avoid this error? @files probably co

Re: checking gzip files

2005-12-30 Thread Adriano Ferreira
On 12/30/05, Xavier Noria <[EMAIL PROTECTED]> wrote: > Even if gzipped files have always more than 0 bytes, wouldn't it be > true than all empty gzipped files have the same size, and that non- > empty gzipped files are greater than that minimum? In this Mac that > size seems to be 24 bytes. Nope.

Re: A "sub" question...

2005-12-30 Thread Adriano Ferreira
On 12/30/05, Robert Hicks <[EMAIL PROTECTED]> wrote: > Note the leading underscore in the sub name. What does that mean? Is that > like making it "private"? Yes. But as a convention: that means: you sensible reader, don't you try to rely on this function outside of this immediate realm of code. Bu

Re: checking gzip files

2005-12-30 Thread Adriano Ferreira
On 12/30/05, S Khadar <[EMAIL PROTECTED]> wrote: > #!/usr/bin/perl > use Shell; ... > $dmchk=zless( "$dir/$_/foo.gz"); As an aside note, C advises against this style [ use Shell ; ]. Prefer this: use Shell qw(zless); so that you know that you are not calling some program by mistake/t

Re: Each char / letter --> array from string value

2005-12-28 Thread Adriano Ferreira
On 12/28/05, Umesh T G <[EMAIL PROTECTED]> wrote: > I need to put each letter from a string to an array. The usual way to tear apart a string into an array with characters is @chars = split '', $string; It is documented at C. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional comma

Re: problem passing argument to function

2005-12-28 Thread Adriano Ferreira
On 12/28/05, Khairul Azmi <[EMAIL PROTECTED]> wrote: > That one works using a solution > I found on the web but the problem is when I tried to pass the argument to a > function declared in the same file, the argument somehow became null. > sub sample_function { > print "go in $_\n";

Re: [PATCH] Test that constant overloading is propagated into eval

2005-12-27 Thread Adriano Ferreira
On 12/26/05, Robin Houston <[EMAIL PROTECTED]> wrote: > +# Check that constant overloading propagates into evals As a further confirmation of the fact, the following one-liner (using bigint and eval with strings) that used to output $ perl -Mbigint -e "my $x = eval '1+2'; use Data::Dumper; pr

Re: why is 0 first?

2005-12-27 Thread Adriano Ferreira
>I am curious what the reasoning behind the first element of > something being zero is ($array[0]). I know I've read it before, but > I can't remember. Thanks! Using indices 0 .. n make it possible to work with them like offsets from the beginning of the array. More important from a C point

Re: maximum int value

2005-12-27 Thread Adriano Ferreira
On 12/27/05, Alon Marx <[EMAIL PROTECTED]> wrote: > Is there a constant or a definition for a maximum number in perl? And > the same question for a minimum value? This may work for you the biggest unsigned integer $ perl -e 'print ~0' 18446744073709551615 # 64-bit integers the maximum signed in

Re: How to check for a file already opened

2005-12-23 Thread Adriano Ferreira
On 12/22/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > How can I check inside a script to see if a file has already been > opened early and is still open? Does the perl interpreter keep track > of that kind of stuff. Maybe what you want is the function C from C module. See perldoc Scala

Re: for send an email

2005-12-23 Thread Adriano Ferreira
On 12/23/05, Rafael Morales <[EMAIL PROTECTED]> wrote: > I need to send an email to some clients, so I need to know if their mail > client can accept html format or just text format. How can know that ???, I > think that there is, some cpan module to do that however I haven't found it. When you

Re: encode base64 password

2005-12-22 Thread Adriano Ferreira
On 12/22/05, Ken Perl <[EMAIL PROTECTED]> wrote: > Is the MIME::Base64 support unicode? MIME::Base64 supports conversion of binary data into a limited character set, convenient for transmission by e-mail and other means that prefer pure ASCII data. > I am trying to use the module to encode the a

Re: use vars

2005-12-15 Thread Adriano Ferreira
On 12/15/05, Beast <[EMAIL PROTECTED]> wrote: > In perlmodlib : > varsPredeclare global variable names (obsolete) > If this is obselete then what is the newer version of predeclare global > variables? Replace things like use vars qw($FOO) with our $FOO; (unless you need to assur

Re: A Strange Syntax

2005-12-06 Thread Adriano Ferreira
On 12/5/05, Jennifer Garner <[EMAIL PROTECTED]> wrote: > As we know, $::{sym} == *main::sym, it's a typeglob. > but what is **main::sym? and the same,what is *{$glob}?thanks. **main::sym is a syntax error, but *{*main::sym}==*main::sym. But don't be fooled by the equality $::{sym} == *main::sym.

Re: A Strange Syntax

2005-12-05 Thread Adriano Ferreira
On 12/5/05, Jennifer Garner <[EMAIL PROTECTED]> wrote: > print ${*{$::{sym}}{HASH}}{name}; > How to analyse the last sentence of that code?Thanks. >From "perldoc perlref" 7. A reference can be created by using a special syntax, lovingly known as the *foo{THING} syntax. *foo{T

Re: Perl executable pathname needs to be hardwired?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Chris Devers <[EMAIL PROTECTED]> wrote: > My understanding is that the Python idiom is to avoid putting the full > path, in favor of something like > > #!/usr/bin/env python > #!env python > > on grounds that Python may not be quite as common, but you could depend > on the `env`

Re: Archive

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Brent Clark <[EMAIL PROTECTED]> wrote: > Anyone know if theres an archive link for this mailing list. You can find The Perl Mailing List Database at http://lists.perl.org and from there http://lists.cpan.org/showlist.cgi?name=beginners where you will find th

Re: Perl executable pathname needs to be hardwired?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Chris Devers <[EMAIL PROTECTED]> wrote: > But anyway, yeah. In general, you can't depend on things working > consistently if you just start randomly moving around compiled programs > and libraries. Sometimes it won't matter, but other times, the results > just won't be predictable. Ok.

Re: Perl executable pathname needs to be hardwired?

2005-12-02 Thread Adriano Ferreira
On 12/2/05, Chris Devers <[EMAIL PROTECTED]> wrote: > Historically, Unix users could depend on a copy of Perl in /usr/bin from > their vendor, and maybe a custom-installed one somewhere like /opt/bin > or /usr/local/bin. With that in mind, using one of those paths usually > would do something usefu

Perl executable pathname needs to be hardwired?

2005-12-02 Thread Adriano Ferreira
What's the rationale for hardwiring the Perl executable pathname into the Perl interpreter? It is some oddity to guarantee Perl can find its library via a relative path? Is it a safety thing? Adriano. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: max value of an integer scalar

2005-11-03 Thread Adriano Ferreira
On 11/3/05, JeeBee <[EMAIL PROTECTED]> wrote: > > Thank you, John! > I see the limit is 32 bits now. > I just added 'use bigint', how easy! > > Further, I was wondering about why you said I wasn't just multiplying by > 2 using $p<<=1. Isn't it exactly equal to $p*=2 ??? It is equal just up to the

Re: finding the first non digit character in a string

2005-10-28 Thread Adriano Ferreira
On 10/28/05, Bowen, Bruce <[EMAIL PROTECTED]> wrote: > The data may look like this: > $DD = "5000|SIHHTEXT" > I've tried $d = index($DD, m/[^\d]/); > $d = index($DD, /[^\d]/); > $d = index($DD, [^\d]); C doesn't work with regexes. But you can use C $ perl -e '$DD = "5000|

Re: Digest::MD5 hexdigest() and md5_hex() differ

2005-10-18 Thread Adriano Ferreira
On 10/18/05, Gert <[EMAIL PROTECTED]> wrote: > in the example below I am using Digest::MD5 for computing the md5-checksum > for a string. The first solution uses the function md5_hex, the second way > uses the OO method hexdigest. The results are not equal. Shouldn't they be > equal? I think they s

  1   2   >