regex

2024-01-22 Thread Jorge Almeida
Please help me to understand this: $ perl -e 'exit(10) if "aaa"=~/a{,2}/;' $ echo $? $ 10 Thanks Jorge Almeida

symlink to "pack"

2019-09-07 Thread Jorge Almeida
d "foo" pointing to a 2-byte string. Yes, it would be a broken symlink. (Yes, this is how I want it). Symlink() can create broken links, the problem is the target. What to do? (And why doesn't it work?) TIA Jorge Almeida -- To unsubscribe, e-mail: beginners-unsubscr...@per

Re: unexpected escaping

2016-01-29 Thread Jorge Almeida
On Fri, Jan 29, 2016 at 2:48 AM, Charles DeRykus wrote: > On Fri, Jan 29, 2016 at 12:39 AM, Jorge Almeida wrote: >> Can someone help me to understand this? >> >> #!/usr/bin/perl >> use strict; >> use warnings; >> my $s='\\n'; >> print $

unexpected escaping

2016-01-29 Thread Jorge Almeida
Can someone help me to understand this? #!/usr/bin/perl use strict; use warnings; my $s='\\n'; print $s; Output: \n Expected output: \\n TIA Jorge Almeida -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@per

Re: multiplier in replacement string

2014-02-05 Thread Jorge Almeida
On Wed, Feb 5, 2014 at 8:11 PM, Uri Guttman wrote: > On 02/05/2014 02:52 PM, Jorge Almeida wrote: >> >> $s="ab"; >> $s=~s/a/AA/; # $s is now "AAb" >> >> >> I would like to achieve the same with something similar to the x >> multipli

multiplier in replacement string

2014-02-05 Thread Jorge Almeida
$s="ab"; $s=~s/a/AA/; # $s is now "AAb" I would like to achieve the same with something similar to the x multiplier: $n=2; $s="A"x$n."b"; # $s is "AAb" $s="ab"; $n=2; $s=~s/a/Ax$n/; # doesn't work, of course; $s is Ax2b Is it po

Re: How to get rid of underline in Term::Readline::GNU's prompt?

2009-05-05 Thread Jorge Almeida
al. I also googled and searched CPAN but failed to get the > answer. Did anyone here hit this before? > $self->{'term'}->Attribs->ornaments(0); HTH. Jorge Almeida -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

Segfault with Term::ReadLine::GNU

2008-11-04 Thread Jorge Almeida
o difference). I had to reinstall all the system, for reasons unrelated to Perl, so I can't say which versions I had before (which worked without a flaw). I have several applications depending on Term::ReadLine::GNU that just went dead... Any workaround? Thanks... -- Jorge Almeida -- To unsubscri

Re: Define NULL value in Perl

2008-07-09 Thread Jorge Almeida
guess that you get it with an escaped zero: $ perl -e '$s="\0";print $s,"X\n";' X ~ $ perl -e '$s="\0";if($s=~/\0/){print "yes\n";}' yes ~ $ perl -e '$s="";if($s=~/\0/){print "yes\n";}' ~ -- Jorg

vim--Term::Readline::Gnu problem

2007-08-08 Thread Jorge Almeida
gives way to a unique line: ^[[?1034h Any idea? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: customizing eof chatacter

2007-08-06 Thread Jorge Almeida
On Mon, 6 Aug 2007, Ken Foskey wrote: On Sun, 2007-08-05 at 18:26 +0100, Jorge Almeida wrote: It sounds like you want something similar to parameter handling, generally this works on escalating files. eg /etc/myprog overridden by ~/.myprog overrridden by a specific options file and so on

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, Mr. Shawn H. Corey wrote: See `perldoc perlfaq8` and search for "How can I open a pipe both to and from a command?" Thank you. I'll have to decide whether using IPC::Open2 is safe enough... -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
w this doesn't work! 8 for (@chunk){ print H $_;} 9 while(){ 10 # do the real work now... 11 } The problem, of course, starts with line 7... I took a look at open(W,"|-") and open(R,"-|"). No good, the program is too complex

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, John W. Krahn wrote: Jorge Almeida wrote: Is there some variable that will do for a file what $/ does for a record? Note that reading STDIN line by line and checking for a character won't do the job, because somewhere in the program I need something like

Re: customizing eof chatacter

2007-08-05 Thread Jorge Almeida
On Sun, 5 Aug 2007, Mumia W. wrote: On 08/05/2007 07:21 AM, Jorge Almeida wrote: open(F,"do-something|"); while(){...} and later open(G,"do-something-else|") while(){...} What do F and G have to do with STDIN? Everything... The code "while()

customizing eof chatacter

2007-08-05 Thread Jorge Almeida
put is redirected from some file, I would need a way to divide the file into chunks, so that each chunk would be treated as the whole STDIN each time @arr= or open(F,"do-something|") appears in the program. Any suggestion? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: regexp problem

2007-06-14 Thread Jorge Almeida
On Thu, 14 Jun 2007, Xavier Noria wrote: On Jun 14, 2007, at 12:10 PM, Martin Barth wrote: On Thu, 14 Jun 2007 11:04:51 +0100 (WEST) Jorge Almeida <[EMAIL PROTECTED]> wrote: > I'm missing something about Perl's regexp: > >1 #!/usr/bin/perl -w >2 use stri

Re: regexp problem

2007-06-14 Thread Jorge Almeida
On Thu, 14 Jun 2007, Martin Barth wrote: On Thu, 14 Jun 2007 11:04:51 +0100 (WEST) Jorge Almeida <[EMAIL PROTECTED]> wrote: I'm missing something about Perl's regexp: 1 #!/usr/bin/perl -w 2 use strict; 3 my $s=; 4 $s=~s/\D*//; 5 $s=~s/\D*//; 6 print "

regexp problem

2007-06-14 Thread Jorge Almeida
x27;$s=~s/\D*//g;' and comment out line 5. It will work then, but that is not the point. I could also substitute line 5 by '$s=~s/\D+//;' and it would also work... -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

What happened to Getopt::Std ?

2007-06-13 Thread Jorge Almeida
http://search.cpan.org/search?m=module&q=getopt&s=21 ???? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: slurp hash from file

2007-02-27 Thread Jorge Almeida
On Tue, 27 Feb 2007, Adriano Ferreira wrote: On 2/27/07, Jorge Almeida <[EMAIL PROTECTED]> wrote: Let's say your data is in the file "data.pl". Then my %hash = do "data.pl"; my $hash_ref = \%hash; Great! Thanks. -- Jorge Almeida -- To unsubscribe

slurp hash from file

2007-02-27 Thread Jorge Almeida
aa', b => 'aa &&\ bbb', I could then slurp the file as a single string, split the string on /\n\n/, etc., because I know the hash values will not contain empty lines. But this leaves an uncomfortable feeling, since the original file contents ar

Re: find user name

2007-02-11 Thread Jorge Almeida
On Sun, 11 Feb 2007, Peter Scott wrote: On Sun, 11 Feb 2007 13:42:39 +, Jorge Almeida wrote: Is there some efficient way to get a user/group name out of a numerical uid/gid (in Linux)? Why, yes. perldoc -f getpwuid, perldoc -f getgrgid. Thank you. -- Jorge Almeida -- To unsubscribe

find user name

2007-02-11 Thread Jorge Almeida
Is there some efficient way to get a user/group name out of a numerical uid/gid (in Linux)? Something like $username=getusername($uid) (Of course, one can parse /etc/passwd, build a hash, etc. Is there something like this ready to use?) -- Jorge Almeida -- To unsubscribe, e-mail

Re: % installing question

2007-01-09 Thread Jorge Almeida
. The problem I mentioned is either something very obvious for people who usually install from source or else some detail in the developers league. The symlink workaround does the job, but I still would like to know whether I did something wrong... Cheers. -- Jorge Almeida -- To unsubscribe, e-mail: [

Re: %Re: installing question

2007-01-09 Thread Jorge Almeida
ll, I apologize if my comment offended someone. My despise for Windows doesn't extend to people using it, and certainly not to those who are also Perl users. Cheers. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: installing question

2007-01-09 Thread Jorge Almeida
On Tue, 9 Jan 2007, Arvind Autar wrote: gentoo is a bad distrobution you should remove it and install a sane distrobution. I will follow your suggestion, of course. What brand of Windows do you favor? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e

installing question

2007-01-09 Thread Jorge Almeida
hich. (I know I can solve the problem by creating a symlink /usr/local/perl to /usr/local/opt/perl, but I would like to know what went wrong.) -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: my, my...

2006-12-17 Thread Jorge Almeida
On Sun, 17 Dec 2006, Jeff Pang wrote: There is a good article about Perl's variable scope. I think you maybe need to take some time to read it seriously: http://perl.plover.com/FAQs/Namespaces.html.en Good link. Thanks. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED

Re: my, my...

2006-12-15 Thread Jorge Almeida
se. I didn't know that you could do that when using strict. I always use my or our, so I hadn't encounter this behaviour yet. Thank you. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

my, my...

2006-12-15 Thread Jorge Almeida
ogram is: 27 Just what I would expect if line 4 had "our" instead of "my". What am I missing? TIA. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: locked memory?

2006-09-30 Thread Jorge Almeida
On Sat, 30 Sep 2006, Tom Phoenix wrote: On 9/30/06, Jorge Almeida <[EMAIL PROTECTED]> wrote: Is there some way to keep a string in RAM, not allowing it to go to swap? Just like gnupg does with passphrases, and for similar reasons. (Linux only, no portability required!) Not in pur

locked memory?

2006-09-30 Thread Jorge Almeida
Is there some way to keep a string in RAM, not allowing it to go to swap? Just like gnupg does with passphrases, and for similar reasons. (Linux only, no portability required!) -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <h

Re: Standard input Question

2006-09-26 Thread Jorge Almeida
On Tue, 26 Sep 2006, elite elite wrote: If i going to write a script with a standard input how would it look like?My perl book don't talk about it. Craig What book? And what part thereof did you read? (Besides the cover, that is...) -- Jorge Almeida -- To unsubscribe, e-mail: [

Re: using CTRL-C to abort a routine?

2006-07-05 Thread Jorge Almeida
abort=0; $SIG{'INT'}=sub{ $SIG{'INT'}='IGNORE'; $abort=1; }; while(){ return if $abort; # do your job... } Thank you. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For a

using CTRL-C to abort a routine?

2006-07-04 Thread Jorge Almeida
tine(), but what can the latter do to exit myroutine? Putting exit in place of (??) would exit the program, which is not what I want. Is this possible? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

RE: eval problem

2006-06-27 Thread Jorge Almeida
On Tue, 27 Jun 2006, Smith, Derek wrote: So could this `$SIG{'PIPE'}="IGNORE";' be considered a global similar to $ENV{"PATH"} = qq(/opt/SUNWsamfs/sbin:/usr/bin); Yes, %SIG is a global hash. Jorge -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED

Re: eval problem

2006-06-27 Thread Jorge Almeida
On Tue, 27 Jun 2006, John W. Krahn wrote: Jorge Almeida wrote: What is happening? When find dies a SIGPIPE signal is sent to the parent process which kills it. Thank you. Putting `$SIG{'PIPE'}="IGNORE";' in the beginning of my program solves my problem. Jo

eval problem

2006-06-27 Thread Jorge Almeida
t;" is there to check). I tried using a unique "eval" around everything since "open" till "close OUT". No joy. What is happening? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Term::Readline

2006-06-16 Thread Jorge Almeida
Anyone knows some tutorial about using Term::Readline::Gnu? Or some article, somewhere? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: module for killing?

2006-05-09 Thread Jorge Almeida
On Tue, 9 May 2006, zentara wrote: On Tue, 9 May 2006 09:57:29 +0100 (WEST), [EMAIL PROTECTED] (Jorge Almeida) wrote: Is there any Perl module to find and kill unix processes (pgrep, kill, pkill...). I need to kill all processes descending from a given process (children, grandchildren, etc

module for killing?

2006-05-09 Thread Jorge Almeida
seems clumsy. -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: rounding in perl?

2005-07-12 Thread Jorge Almeida
Thanks to everyone for the help provided. I already have two working solutions. :) -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: rounding in perl?

2005-07-12 Thread Jorge Almeida
t;0." . "0" x $decimals . "5"), 0, $decimals+length(int($number))+1); } Yes! :):):) I still get 12.449 --> 12.5 but this is acceptable. Many thanks, Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: rounding in perl?

2005-07-12 Thread Jorge Almeida
rounding is being used by Perl, but to instead implement the rounding function you need yourself. Yes, I read that yesterday. Hope there is an easier solution... -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.

rounding in perl?

2005-07-12 Thread Jorge Almeida
("%.1f", $a); print $a;' 11.4 -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>

Re: WTH is Perlmonth?

2004-07-26 Thread Jorge Almeida
On Mon, 26 Jul 2004, Jenda Krynicky wrote: I think it simply died and these worms are feasting on the dead flesh :-( A pox on all of them... At least they do not try to install their silly useless page as my browser's homepage like most of these guys do. Is that possible at all?! Spooky... Cheers,

WTH is Perlmonth?

2004-07-26 Thread Jorge Almeida
rlmonth.com/ I didn't knew this site. The question is: has it been hijacked? -- Jorge Almeida -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>