XML::Rabbit and utf8

2015-09-23 Thread Martin Barth
Hello, i'm struggling around with umlauts in my xml files, which i want to parse with XML::Rabbit. I've got the same behaviour with __DATA__ or when i'm reading a xml file via MyNode->new(file => ); And i've got non idea what i am doing wrong :( (ps: yes, the testcase is utf8 encoded

Re: Perl hash

2015-07-31 Thread Martin Barth
and hashes are not sorted, like lists are. Martin Am 31.07.2015 um 08:28 schrieb Uday Vernekar: Hashes are complex list data, like arrays except they link a key to a value. Hashes can be used for counting, uniqueness, searching, and dispatch and lot more than just mapping from one thing to

Re: Perl beginner

2015-07-30 Thread Martin Barth
good luck with it! Am 01.07.2015 um 18:40 schrieb bikram behera: Hi Team, I am new in perl , i want to learn perl. Thanks, Bikram Behera -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/

List::MoreUtils

2012-08-08 Thread Martin Barth
Hello Everyone, I am slightly confused... I've got a Centos 6.3 Installation with its perl (version 5.10.1) and i am Using the Module List::MoreUtils which comes with the Linux Distribution. [root@bach perl-lib]# cd /tmp/ [root@bach tmp]# perl -MList::MoreUtils -MData::Dumper -wle 'print Dumper

Re: List::MoreUtils

2012-08-08 Thread Martin Barth
Hi Shlomi, Everyone On 12:38:40 08/08/2012 Shlomi Fish shlo...@shlomifish.org wrote: perl-5.10.1 is very old and no longer actively maintained. There's already perl-5.16.0. List::MoreUtils is at version 0.33: https://metacpan.org/release/List-MoreUtils . I am aware that this perl is quite an

Starting with ::

2008-12-02 Thread Martin Barth
Hello, whats the difference if you start a variable with :: for example: $::a $a $main::a or: Package Foo; $::a # - this is still main?! $::Foo::a $Foo::a $a didn't found information in the perldoc. Regards Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,

Re: Starting with ::

2008-12-02 Thread Martin Barth
$::Foo::a This is a shortcut for $main::Foo::a % perl -e 'package Foo; $a = 2; print $::Foo::a' 2% % perl -e 'package Foo; $a = 2; print $Foo::a' 2% 2 so every package is a subpackage of main? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL

Re: printing array elements

2008-10-09 Thread Martin Barth
Hey, print $array[0],$array[1],$array[2]; etc. There are different ways: 1) print @array; usually you want to see which element is at which index so 2) print join( - , @array); is maybe better. HTH Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: Regex in a variable

2008-09-01 Thread Martin Barth
what about qr()? have a look at perldoc perlop if it fits your needs. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

RE: setting unix command through perl script

2008-04-17 Thread Martin Barth
that the parent process in which perl was invoked will not be changed by the perl script. What is the overall objective? Try to do everything you need to do inside the perl script, or everything you need to do outside the perl script. HTH, Ken Wolcott On Wed, Apr 16, 2008 at 5:31 AM, Martin

RE: setting unix command through perl script

2008-04-17 Thread Martin Barth
- From: Martin Barth [mailto:[EMAIL PROTECTED] Sent: Thursday, April 17, 2008 1:01 PM To: beginners@perl.org Subject: RE: setting unix command through perl script Hi your command is executed. it changes the environment of the shell you spawn with qx(); but after this statement your shell dies

RE: setting unix command through perl script

2008-04-17 Thread Martin Barth
is there. If I don't execute this command then entire task would fail. So it's very important that I should set this variable with proper value and then start the execution of the task. Regards, Irfan -Original Message- From: Martin Barth [mailto:[EMAIL PROTECTED] Sent: Thursday, April

RE: setting unix command through perl script

2008-04-17 Thread Martin Barth
/25605000 (Extn: 5271) Mobile: +91 9822 854 227 Fax: +91-020 25674090 Internet: http://www.t-systems.com -Original Message- From: Martin Barth [mailto:[EMAIL PROTECTED] Sent: Thursday, April 17, 2008 4:42 PM To: beginners@perl.org Subject: RE: setting unix command through perl script

RE: setting unix command through perl script

2008-04-16 Thread Martin Barth
i think this is not possible. if you start a new process (shell) it gets the environment of its parent process. but if you manipulate the environment in a child the parent will not notice this.. for example $ bash $ export FOO=BAR $ echo $FOO BAR $ exit $ echo $FOO Regards Martin On

Re: Tokenizing a string

2008-02-11 Thread Martin Barth
On 12:33:09 11/02/2008 Allam Reddy, Thomas [EMAIL PROTECTED] wrote: Hi All, I have a string jdbc/abc.xml which I wanted to tokenize using the delimiter / May I know the perl code for this? Thanks Thomas Reddy hi, you could use split in this situation. @tokens = split(/\//, $string);

Re: print a selection of a file

2008-01-09 Thread Martin Barth
#!/opt/perl/bin/perl -w use strict; #variable my @horcm_file; sub readdata{ open(HORCM, /etc/horcm10.conf) || die (File error); @horcm_file = HORCM; chomp(@horcm_file); close(HORCM); return(@horcm_file); } my @pipo=readdata(); foreach (@pipo){ /HORCM_INST/ or

Re: avoid using a temporary variable

2008-01-08 Thread Martin Barth
On 0:59:22 08/01/2008 Robert Citek [EMAIL PROTECTED] wrote: How can I get rid of the @foo? $ ls | perl -e '@foo=; chomp @foo ; print join( , @foo)' hi! ls | perl -pe 's/\n\ /' perldoc perlrun: -p causes Perl to assume the following loop around your program, which makes

Re: Use parentheses in translation strings

2008-01-02 Thread Martin Barth
hi, you probably want to use s/// instead of tr///. # perl -wle '$_=; s//(\\d\\d\\d\\d)/; print' (\d\d\d\d) have a look at perldoc perlop to see what tr or y really does: tr/SEARCHLIST/REPLACEMENTLIST/cds y/SEARCHLIST/REPLACEMENTLIST/cds Transliterates all

Re: Perl loop

2007-12-14 Thread Martin Barth
Hi Perhaps $touchcmd and $chkstat could be done in perl instead of running them in an external process? What exactly do $touchcmd and $chkstat do? $chkstat=cat tmp; The source looks to me that you only want to see if the file is created or not? you can simply call open(); to check this for

Re: Perl loop

2007-12-14 Thread Martin Barth
tat do? sorry john, what do you mean by that? :( I took the code: #!/bin/perl $interfaces=Output - working interface; $chkstat=cat tmp; $touchcmd=touch test; if (system($touchcmd) system($chkstat)) { from the first e-mail -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: seek/tell usage

2007-12-11 Thread Martin Barth
i hope i can clarify what whence means: snip For WHENCE you may use the constants SEEK_SET, SEEK_CUR, and SEEK_END (start of the file, current position, end of the file) from the Fcntl module. snip whence descripes from where you start counting bytes: if you use SEEK_SET

Re: seek/tell usage

2007-12-11 Thread Martin Barth
On Tue, 11 Dec 2007 14:28:01 -0500 Chas. Owens [EMAIL PROTECTED] wrote: The seek function has three ways of measuring what the second argument means: 0: move relative the beginning of the file 1: move relative to the current position in the file 2: move relative to the end of the file Where

Re: seek/tell usage

2007-12-11 Thread Martin Barth
ahh I am sorry! all my fault! I didn't see that line and I started searching for the meaning of WHENCE after the Constants are explained. oups! Regards. Martin On Tue, 11 Dec 2007 14:40:24 -0500 Chas. Owens [EMAIL PROTECTED] wrote: On Dec 11, 2007 2:32 PM, Martin Barth [EMAIL PROTECTED

Re: How can I sort files by timestamp without slurping?

2007-11-29 Thread Martin Barth
Hi, I'm thinking on incorporating a timestamp sorting mechanism without slurping. You wouldn't slurp anything. You would just assign the _names_ of the files to an array. Why would that be so bad? If you have that much files that you do not want to put all names in an array you could

Re: Date and Time and Function calls

2007-11-25 Thread Martin Barth
Hi Andrew, I would suggest http://search.cpan.org/~tjenness/File-Temp-0.19/Temp.pm HTH Martin On Sat, 24 Nov 2007 08:44:18 -0800 AndrewMcHorney [EMAIL PROTECTED] wrote: Hello I am looking for a perl function or functions that will give me the date and time. I am going to use the

Re: PAR-PP package on Windows

2007-11-16 Thread Martin Barth
anders accedently only worte a usefull mail to me: anders [EMAIL PROTECTED] wrote Hi! Tanks for pointing out the error I have solve it by adding a extra resource (activestate was not up-to- date) In ppm manager a added http://theoryx5.uwinnipeg.ca/ppms/package.xml And select show-all package

Re: PAR-PP package on Windows

2007-11-16 Thread Martin Barth
Hi, I am trying the same thing, too. this describes why there is no pp. http://par.perl.org/wiki/FAQ#Why_doesn.27t_PAR_include_pp_any_more.3F if you have a solution please show it to us :) Regards, Martin On 9:03:00 16/11/2007 anders [EMAIL PROTECTED] wrote: I have installed PP

Re: AFAIK

2007-09-24 Thread Martin Barth
Hi, AFAIK = as far as i know HTH = hope that helps HTH! ;) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: How to test for 0

2007-09-24 Thread Martin Barth
Hi you can test if something is defined with if( defined( $var ) ) ( in addition: for hashs there is also exists() ) HTH Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: marine subroutine

2007-08-30 Thread Martin Barth
Hi, be nice to yourself and allways use strict; and don't call subs with , unless you know why you need . hopefully you can avoid some problems when you're writing perl code. #!/usr/bin/perl use strict; marine(); HTH, Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: marine subroutine

2007-08-30 Thread Martin Barth
On Thu, 30 Aug 2007 15:39:14 +0100 Andrew Curry [EMAIL PROTECTED] wrote: That's rubbish, but you get a warning like: main::a() called too early to check prototype at -e line 1. Use Prototypes at the beginning of your file if you want to write the subs at the end. HTH, Martin -- To

Re: marine subroutine

2007-08-30 Thread Martin Barth
Hi, I don't get that either !!! #!/bin/perl ### junk.pl ### use strict; use warnings; sayhello(); sub sayhello { print hello\n; } thats because you're not using perls prototyping feature at all. if you define your sub that way: sub sayhallo() { print hello\n; }

Re: Longest prefix match

2007-08-27 Thread Martin Barth
sorry, I forgot to send my mail to the list: Jeff Pang schrieb: then use regex or other ways (I prefer substr) to get the prefix. my $prefix = substr($string,1,3); I think the problem is that some countrycodes are only 2 digits some are 3 ( or more ? ) So you dont know how long your prefix

Re: Longest prefix match

2007-08-27 Thread Martin Barth
Hi, do you understand my pseudo code, i think it should work for your hash? Regards Martin thanks, But i have a list of 65 countries, and I only want to implement for them. Also, as you said, definitely for some, prefix length is only 1 digit, while for others, it is 2 or 3 digits. So, I

Re: Longest prefix match

2007-08-27 Thread Martin Barth
into the 14th field. my $tmp = $csv-{Duration} / 60 * $csv-{Rate/sec}; $csv-{what_ever_the_name_of_your_14th_field_is} = $tmp; On 12:17:26 27/08/2007 Mihir Kamdar [EMAIL PROTECTED] wrote: On 8/27/07, Martin Barth wrote:Hi, do you understand my pseudo code, i think it should work for your hash

Re: Need to implement Data::Dumper

2007-08-27 Thread Martin Barth
nitesh kumar schrieb: Hi All, Can anybody suggest me how can I implement my own Data::Dumper(a function which work similar to perl Dumper). Thanks and Regards Nitesh I think ref is your friend. perldoc -f ref HTH, Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

Re: Longest prefix match

2007-08-27 Thread Martin Barth
Hi, if you open your outputfile like open(FH, , $file) you will append all the stuff to the file. Probably you want to replace your file if you run your script again. open(FH, , $file) HTH, Martin On Mon, 27 Aug 2007 22:53:16 +0530 Mihir Kamdar [EMAIL PROTECTED] wrote: Hi Chas, It

Re: File::Find

2007-08-27 Thread Martin Barth
Hi, I dont use perl on windows, so if there are any special things about File::Find your Filesystem I can't help you. Please show us the code you're using to find the files you're looking for. Maybe we have some hints for you. HTH, Martin On Tue, 28 Aug 2007 00:28:40 +0530 Somu [EMAIL

Re: File::Find

2007-08-20 Thread Martin Barth
On Fri, 17 Aug 2007 07:48:33 -0700 [EMAIL PROTECTED] (Randal L. Schwartz) wrote: Why not just: my @list; find sub { push @list, $File::Find::name }, /var/SAMPLES; HTH -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Ability to do numeric and alpha sort in one pass on data which is compirsed of both

2007-08-14 Thread Martin Barth
Hi there, http://search.cpan.org/~sburke/Sort-Naturally-1.02/lib/Sort/Naturally.pm HTH, martin. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: die and exit

2007-08-13 Thread Martin Barth
there is a difference between the function exit: perldoc -f exit and a sub you have defined by your own. even if you re-use a name of a build-in. thats why you called exit via exit; and not exit; or exit(); #!/usr/bin/perl -w sub exit(){ print sub exit called\n; } exit; exit(); if

Re: library (random numbers)

2007-08-07 Thread Martin Barth
On Tue, 07 Aug 2007 11:23:05 +0300 Amichai Teumim [EMAIL PROTECTED] wrote: Line 11 n obj13-lib.pl is: (last index). Double check I don't know what could be wrong with this syntax, as I have never used these commands before. I thought it migh need a curly, but I get the same error.

Re: Exception handling in perl

2007-07-12 Thread Martin Barth
On Thu, 12 Jul 2007 16:06:27 +0530 Pushkar Pande [EMAIL PROTECTED] wrote: How do we handle exceptions in perl? there is a Error.pm in CPAN, which allows you to write code like that try { something(); } catch Error with { code(); }otherwise{ foobar(); }; -- To

Re: Still stuck with my cards

2007-07-12 Thread Martin Barth
Because he wants the final string to be Jokerack, why else? (Possibly a rack for storing jokes ;) *gg* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: For Loop error: Missing $ on loop variable at time.pl line 7.

2007-07-10 Thread Martin Barth
for my ($index = 0; $index = 10; $index++) { print ($hour:$min:$sec\n); } for my $index (0..10){ print ($hour:$min:$sec\n); } hth -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: Simple perl math caculation question

2007-07-10 Thread Martin Barth
On Tue, 10 Jul 2007 11:32:54 -0700 (PDT) Vincent Li [EMAIL PROTECTED] wrote: I am trying to experiment a simple perl math caculation script I wrote: #!/usr/bin/perl use strict; use warnings; my %operator = ( minus = '-', add = '+', multiply = '*', divide = '/',

[Fwd: Re: deck of cards the saga]

2007-07-09 Thread Martin Barth
; } Why is it printing all this mess? I just want 5 top cards. On 7/9/07, Martin Barth [EMAIL PROTECTED] wrote: Amichai Teumim schrieb: Hi In my deck of cards I want to replace the letter of the card with the name( e.g. A = Ace). So I tried to implement the following snippet into my code

Re: Global symbol $var1 requires explicit

2007-07-08 Thread Martin Barth
it is varl - L and var1 - 1, isn't it? looks like a typo. HTH On Sun, 8 Jul 2007 20:38:43 +0200 xavier mas [EMAIL PROTECTED] wrote: Name main::varl used only once: possible typo at sample.pl line 3. Name main::var1 used only once: possible typo at sample.pl line 2. -- To unsubscribe,

Re: query about code

2007-07-04 Thread Martin Barth
Hi, it was hard to see the blue stuff.. :) On Wed, 4 Jul 2007 16:14:47 +0300 Amichai Teumim [EMAIL PROTECTED] wrote: #!/usr/bin/perl $startdir = /lib; $level = 0; list_dirs($startdir,$level); calls list_dir with $startdir and $level. sub list_dirs(){ my $dir = shift (@_);

Re: TWO loops and ONE if statement

2007-07-03 Thread Martin Barth
Hi maybe this wikipedia article can show you different sorting algorithems: http://en.wikipedia.org/wiki/Sorting_algorithm#Summaries_of_popular_sorting_algorithms there are examples in pseudocode. HTH, Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail:

Re: sorted hash positions

2007-07-02 Thread Martin Barth
On Mon, 02 Jul 2007 06:20:26 -0700 [EMAIL PROTECTED] wrote: lets say you're looking for 34567 so my $what_i_am_looking_for = 34567; # LOOP THROUGH IT foreach $value (sort {$coins{$a} cmp $coins{$b} } keys %coins) { next unless $value == $what_i_am_looking_for; print $value---

Re: sorted hash positions

2007-07-02 Thread Martin Barth
ohh I forgot something - oops my $what_i_am_looking_for = 34567; my $index = 0; # LOOP THROUGH IT foreach $value (sort {$coins{$a} cmp $coins{$b} } keys %coins) { $index++; next unless $value == $what_i_am_looking_for; print $value---$index $coins{$value}\n; } -- To

Re: exit code

2007-06-29 Thread Martin Barth
exit codes are stored in 1 byte. so you can only exit with 2^8 == 256 different values. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: exit code

2007-06-29 Thread Martin Barth
I just googled a bit: http://www.hiteksoftware.com/knowledge/articles/049.htm it seems that windows has more exit codes than linux. On Fri, 29 Jun 2007 13:15:18 +0200 Tatiana Lloret Iglesias [EMAIL PROTECTED] wrote: And why i windows I get exit value 777? On 6/29/07, Martin Barth [EMAIL

Re: shuffling cards

2007-06-28 Thread Martin Barth
Hi, If you don't use rand() you will allways get the same result after shuffeling. Is that OK for you? ( you're cheating in card games, right? *eg* ) On Thu, 28 Jun 2007 12:37:29 +0300 Amichai Teumim [EMAIL PROTECTED] wrote: Thanks for all the answers. I know there are other better ways of

Re: shuffling cards

2007-06-28 Thread Martin Barth
? On 6/28/07, Martin Barth [EMAIL PROTECTED] wrote: Hi, If you don't use rand() you will allways get the same result after shuffeling. Is that OK for you? ( you're cheating in card games, right? *eg* ) On Thu, 28 Jun 2007 12:37:29 +0300 Amichai Teumim [EMAIL PROTECTED] wrote

Re: missing curly - brain fried

2007-06-28 Thread Martin Barth
Hi Amichai, first of all never write own code without these two lines: use strict; use warnings; this should allways help a lot. Remember the e-mail from Chas Owens regarding the shuffling cards. making comments in perl goes this way: # hello, i am a comment. you made C-style comments: //,

Re: bug in perl or in my head ;-)

2007-06-20 Thread Martin Barth
Thank you I learnt a lot! Martin -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: bug in perl or in my head ;-)

2007-06-19 Thread Martin Barth
Probably. It's worth a bug report, at least. I sent it. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: bug in perl or in my head ;-)

2007-06-19 Thread Martin Barth
Hi jay, You haven't told us what Perl thinks the encoding of the first file is. how can I do that? file is a system command that makes use of number of different approaches to determine file type including, on some systems, I think it even makes use of metadata. Actually examining

Re: find2perl output to array

2007-06-19 Thread Martin Barth
Hi, change following line: (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) -f _ /^DATA.*\.zip\z/s print($name\n); to (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) -f _ /^DATA.*\.zip\z/s push @files, $name; at the end you have all files in the @files array. HTH Martin

Re: find2perl output to array

2007-06-19 Thread Martin Barth
Hi Matt, I did that, and then at the bottom of the script I tried looping through just to verify that @files was populated - no dice. snip (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) -f _ /^DATA.*\.zip\z/s push @files, name; What have I done wrong? push @files, $name; I

Re: find2perl output to array

2007-06-19 Thread Martin Barth
Hi, Ahh, very good. Thanks Rob (and Martin from earlier). I think I understand now. It calls the wanted sub routine, populates the @files array for each iteration. Then when that completes the contents of the array @files are printed. . .? Matt you're right, Matt. the name of

bug in perl or in my head ;-)

2007-06-18 Thread Martin Barth
Hi there, have a look at: snip % cat datei eine test datei die u a o % file datei datei: ASCII text % cp datei datei.bk % perl -wpi -e 'use encoding utf8; s/a/ä/' datei % file datei datei: ISO-8859 text % perl -wp -e 'use encoding utf8; s/a/ä/' datei.bk datei.neu % file datei.neu datei.neu:

Re: using a homemade perl module

2007-06-15 Thread Martin Barth
block: use lib '/usr/local/bin/lib/'; use dates_emails; Any thoughts? Mathew Keep up with me and what I'm up to: http://theillien.blogspot.com Martin Barth wrote: Hi, try: use lib /usr/local/bin/lib/; use dates_email; HTH Martin On Thu, 14 Jun 2007 01:50:57 -0400

Re: using a homemade perl module

2007-06-15 Thread Martin Barth
oh! you're right! i'm sorry. On Fri, 15 Jun 2007 16:51:48 +0800 Jeff Pang [EMAIL PROTECTED] wrote: Martin Barth 写道: Well the code looks ok. I just wrote some simple test code to do the same thing like you, but it worked as exepcted. Are there some differeces between that example

Re: Why am I getting the error (Maybe you meant system() when you said exec()?) ??

2007-06-15 Thread Martin Barth
Hi, you ment system() wen you said exec()! perldoc -f system perldoc -f exec for short: exec() replaces the perl process. system() invokes your myslqdump process and waits till it is finished. HTH Martin On Fri, 15 Jun 2007 15:17:03 - [EMAIL PROTECTED] wrote: Howdy, Please be

Re: using a homemade perl module

2007-06-14 Thread Martin Barth
Hi, try: use lib /usr/local/bin/lib/; use dates_email; HTH Martin On Thu, 14 Jun 2007 01:50:57 -0400 Mathew Snyder [EMAIL PROTECTED] wrote: To take this further I've changed the code. It now looks like this: package dates_emails; require Exporter; use strict; our @ISA =

Re: regexp problem

2007-06-14 Thread Martin Barth
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=STDIN; 4 $s=~s/\D*//; 5 $s=~s/\D*//; 6 print $s\n; When input is 'a123b', I get '123b', but I

Re: Regading 'perlipc'

2007-06-14 Thread Martin Barth
Hi, There is a %SIG hash with several signal handlers in it. you can overwrite the signal handler for C-c and write your own stuff there. usually you should just set a variable to true. eg. $abort = 1; your programm should poll the var. (for example in the main loop, if there's something like

Re: Hash Key is a Null Value

2007-06-14 Thread Martin Barth
Hi as far as I know hash keys must be strings. So there simply can't be a undef() as a hashkey. to prove what I said: % perl -MData::Dumper -le '$hash{undef()} = foo; $hash{} = bar; print Dumper \%hash' $VAR1 = { '' = 'bar' }; HTH Martin On Thu, 14 Jun 2007 14:03:10 +0200

Re: Run 2 process in parallel.

2007-06-13 Thread Martin Barth
On Wed, 13 Jun 2007 15:20:50 +0530 Umesh T G [EMAIL PROTECTED] wrote: Hola all, I have 2 perl scripts which has to run in parallel. I have run.pl which inturn has to call 1. pl and 2. pl; I am not sure how I can do it using the Perl Threads. Can someone throw some light here. I am

Re: Prompt in Net::Telnet

2007-06-13 Thread Martin Barth
i didnt understand you right, i fear, but if your server is a windows, are you shure that you can execute ls there? On Wed, 13 Jun 2007 12:30:00 -0500 Lakshmi Sailaja [EMAIL PROTECTED] wrote: You are right that I am trying to connect to a Windows m/c from a Solaris server. But when I used

Re: Net::Telnet - Variable in Prompt

2007-06-12 Thread Martin Barth
On Tue, 12 Jun 2007 11:56:12 -0500 Lakshmi Sailaja [EMAIL PROTECTED] wrote: Hi, Is there a way to use a variable in the Prompt parameter like the below line? my $telnet = Net::Telnet-new([HOST = $server,] [PROMPT = /$prompt/,]); Thanks Regards, Lakshmi 952-833-1220

Re: Removing decimal points

2007-06-09 Thread Martin Barth
On Fri, 08 Jun 2007 19:52:59 - ash [EMAIL PROTECTED] wrote: Hello there! I need to remove decimal points from numbers. For eg 1.23 or 1.77 would be just 1. Any suggestion is appreciated. Thank you. my $number = 1.77; print int $number; -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Running perl program at startup

2007-06-08 Thread Martin Barth
Hi, in that case you need to start your deamon by configuring /etc/inittab, don't you? 6:23:respawn:/sbin/getty 38400 tty6 HTH On Fri, 8 Jun 2007 03:16:23 -0400 Chas Owens [EMAIL PROTECTED] wrote: On 6/8/07, Juan Pablo Feria Gomez [EMAIL PROTECTED] wrote: Hi all, I need to start a perl

Re: I can't write the apropriate content to the file.

2007-06-08 Thread Martin Barth
try to change the shebang to #!/bin/sh first of all: you shouldn't use the backticks `` if you dont want to have the output of the program. 2nd: don't use touch, chmod, etc... there are many ways to do it much faster in perl. everytime you do somethink like that you invoke a fork() and start a

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

2007-06-08 Thread Martin Barth
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] ENDOFSQL select 2 from DUAL; exit ENDOFSQL]; what do you think about that: open(DBI, | sqlplus user/[EMAIL PROTECTED]); then

Re: Global varables

2007-05-23 Thread Martin Barth
Hi, seems that there is one msg of you missing... if you want to know something about good style: perldoc perlstyle. there you can find some stuff about (package) globals. if you have a big application maybe you want a data abstraction package which should containt the database handle? -- To

Re: syscall getpwnam and changing authetication on system

2007-05-22 Thread Martin Barth
Hi, afer trying a lot of stuff i figured out that following code line works: my ($login,$pass,$uid,$gid) = (getpwnam($user),rand); without rand it's still the old user... can anyone explain why perl seems to cache this? (even without eval) Tom Phoenix schrieb: On 5/18/07, Martin Barth

Re: Convert german umlaut to ascii

2007-05-21 Thread Martin Barth
On Mon, 21 May 2007 08:41:13 +0200 Andreas Moroder [EMAIL PROTECTED] wrote: Hello, in our application I have to convert all german Umlaute in a string to a two char combination ä to ae, Ö to OE and so on. Can anyone please tell me how to do this ? Thanks Andreas for example: %

Re: syscall getpwnam and changing authetication on system

2007-05-19 Thread Martin Barth
Hello Tom, On 5/18/07, Martin Barth [EMAIL PROTECTED] wrote: print ** . eval(getpwnam('christian')) .\n; sleep 10; Why are you (mis-)using the evil eval? if I do a perl -wle 'print getpwnam(christian)' the correct (new) uid is returned. So, if you don't use

syscall getpwnam and changing authetication on system

2007-05-18 Thread Martin Barth
I am changing the authetication typ, from local to remote ldap on a pc. I want to get the new userid of a user, therefore i have following code. system (/etc/init.d/nscd stop); system (/etc/init.d/winbind restart); print ** . getpwnam(christian) .\n; ## code that changes from local to

Re: yet another regex

2007-05-11 Thread Martin Barth
On Fri, 11 May 2007 17:50:41 -0400 Steve Finkelstein [EMAIL PROTECTED] wrote: echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;' no you're wrong: s///g - matches 5 first. length(9x5) == 5, thats true but now next digit! 0 - length ( 9 x 0 ) == length() == 0 same again -- To unsubscribe,

Re: yet another regex

2007-05-11 Thread Martin Barth
? Martin Barth wrote: On Fri, 11 May 2007 17:50:41 -0400 Steve Finkelstein [EMAIL PROTECTED] wrote: echo 500 | perl -ple 's|(\d)|length(9 x $1)|eg;' no you're wrong: s///g - matches 5 first. length(9x5) == 5, thats true but now next digit! 0 - length ( 9 x 0 ) == length() == 0

Re: yet another regex

2007-05-11 Thread Martin Barth
perldoc perlrun *g* -p causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed: LINE: while () { ... # your program goes here } continue

Exporting in two packages but one file

2007-05-08 Thread Martin Barth
Hi all, I have a Package A with serveral subs in it and now I want to make a package A::Types with some constants in it. I have A.pm with: ..some code and subs .. package A::Type; use constant { CONST1 = foo, CONST2 = bar}; package A; ..some more code and subs.. now I wanted to use the

Re: Exporting in two packages but one file

2007-05-08 Thread Martin Barth
Hi Jeff, that would be a solution. I wanted to be lazy and don't use the complete path. If there is no other solution I just will make a A/Type.pm thanks Martin Jeff Pang schrieb: 2007/5/8, Martin Barth [EMAIL PROTECTED]: but now I dont know to import the stuff. I can't do a use A::Type

Re: Problem sorting hash

2007-05-04 Thread Martin Barth
On Fri, 4 May 2007 16:17:35 +0200 [EMAIL PROTECTED] wrote: On Fri, May 04, 2007 at 07:36:57PM +0800, Jeff Pang wrote: Since you've got the sorted keys,can't you access the full hash? Well, it works this way -- thanks! But I wonder why it's not possible to sort a hash in a more

Re: pure perl replacment for /usr/bin/file

2007-04-29 Thread Martin Barth
Hello, I want to determine the character encoding of some strings I have. Something similar to the file tool, http://search.cpan.org/~knok/File-MMagic-1.27/ John Hi, I am sorry John, i think that won't help me :-( File::MMagic works like File::Type ( which says its a improvement of

Re: creating hash from scalar variable

2007-04-29 Thread Martin Barth
Hi, if you're reading a config file to get the string maybe Config::General is handy. HTH Martin On Sun, 29 Apr 2007 14:27:52 +0100 Goksie [EMAIL PROTECTED] wrote: hello, Can someone help me correct this code. if i print, it only print the first line. Goksie #!/usr/bin/perl use

pure perl replacment for /usr/bin/file

2007-04-27 Thread Martin Barth
Hi, I want to determine the character encoding of some strings I have. Something similar to the file tool, which gives me this information: cp1252.text: Non-ISO extended-ASCII text iso-8859-1.text: ISO-8859 text, with no line terminators macintosh.text: Non-ISO extended-ASCII text

Re: Encryption

2007-04-27 Thread Martin Barth
Hi On Fri, 27 Apr 2007 11:33:47 +0200 Andreas Moroder [EMAIL PROTECTED] wrote: Hello, I have to calculate a hash of username and password in perl. The calculation should be done this way: first the easy stuff, I think you already know that answers to that: 1. Concatenate the username

Re: scape . character

2007-04-27 Thread Martin Barth
Hi, is your version allways number dot number dot number? or can it be.. e.g. 1.2.1a or 1.6 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/

Re: how these two variables are equal numerically?

2007-04-10 Thread Martin Barth
it's: 0 == 0 Hoffmann schrieb: Dr.Ruud wrote: Hoffmann schreef: Could some one explain how, in the example below, $name and $goodguy are equal numerically? $name = 'Mar'; $goodguy = 'Tony'; if ($name == $goodguy) { print Hello, Sir.\n; } else { print Begone,

Re: how to know the object type

2007-04-03 Thread Martin Barth
Anish Kumar K schrieb: Hi In java we have instance operator to tell the type of Object. Similarly in perl say I am passing a reference object to a function, Is it possible to detect in the function whether the object is HASH or ARRAY... Thanks Anish Hi, try this: ref($var);