Re: Hash of Arrays

2005-09-20 Thread Matija Papec
Christopher Spears wrote: while ($line = <>) { ($who, $rest) = split /:\s*/, $line, 2; @fields = split ' ', $rest; $HoA{$who} = [ @fields ]; } The part that confuses me is: ($who, $rest) = split /:\s*/, $line, 2; I understand that it takes the input and splits it into two parts alo

Re: Can't figure out Error.pm

2005-09-18 Thread Matija Papec
Peter Rabbitson wrote: I then tried to change it in the following way, but I get an error: Can't locate object method "catch" via package "DBException" (perhaps you forgot to load "DBException"?) at ./testerror line 16. ^^^ It seems that you're missing "use DBExc

Re: How do you force SOAP::Lite to use document/literal SOAP messages?

2005-09-06 Thread Matija Papec
David Adams wrote: I am trying to write a simple SOAP client written in perl and to talk to a webservice written in .NET. I am unsuccessful. I believe the web service is expecting document/literal SOAP messages but I think the SOAP::Lite module sends stuff in RPC/encoded messages. Is ther

Re: naming subroutine reference parameter?

2005-09-06 Thread Matija Papec
Jeff Pan wrote: > Passing reference as parameter to subroutine is as easy as the normal > way.And,if u pass some types of parameter such as hash,array,or handle > to subroutine,using reference instead is more safer. > for example,such below code is right: It is, however it could be better. > my

Re: infile data

2005-09-06 Thread Matija Papec
Tom Allison wrote: I've been using the practice of putting something at the bottom of a file for holding static data, like SQL, by calling a __DATA__ handle: my $sql = join('',()); #more efficient my $sql = do { local $/; }; check perldoc perlvar if you want to know more about $/ __DATA__

Re: getting the value of a var

2005-08-28 Thread Matija Papec
> #symbol table > my $st = eval '\%$module::'; correction, my $st = eval '\%'. $module .'::'; > # scalar reference > $sref = *{ $st->{content} }{SCALAR}; > print $$sref; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: getting the value of a var

2005-08-28 Thread Matija Papec
Octavian Rasnita wrote: my $module = "Teddy::Languages::${lang}::${mod}"; eval "require $module"; Then I want to print that value, but I don't know how. I have tried: print Teddy::Languages::$lang::$mod::content; print $module::content; I am missing something and I cannot make it work. Pleas

Re: Analyze Log

2005-08-11 Thread Matija Papec
Nick wrote: Hi There, I am trying to analyze a simple log file and pull 2 pieces of data from it. The log looks as follows: www.example.com 42f3ca1042f8c42f0 73380 3638 Where each valie is tab seperated. I want to create a hash with "www.example.com"

Re: __DATA__ Token Problem

2004-07-05 Thread Matija Papec
Bastian Angerstein wrote: I have a few questions regarding to the DATA Filehandle: 1. This handle ist opend by default or do I have to open it by myself? 2. Is it possible to change to content of what the handle so that the __DATA__ Sektion of my skript changes? 3. Can I delete anything data from D

Re: A few questions

2002-07-11 Thread Matija Papec
On 10 Jul 2002 11:06:03 -0400, [EMAIL PROTECTED] (Chas Owens) wrote: >> movie listing and when one item is selected via remote, 'system' >> invokes mplayer which leaves main gtk window blank after it finishes? >> :) > >Perl 5.6.x is not threaded, so anything that blocks (like system) will >keep t

A few questions

2002-07-10 Thread Matija Papec
How to refresh/redraw gtk-perl window? I have one script that shows movie listing and when one item is selected via remote, 'system' invokes mplayer which leaves main gtk window blank after it finishes? :) -- I want to make func

Re: CGI scripts security

2001-11-27 Thread Matija Papec
"Jonathan E. Paton" <[EMAIL PROTECTED]> wrote: >> something like opening a file, but can somebody >> show me how example below can compromise my website? >> >> open(F, "/home/users/me/web/$in{'NAME'}.ext"); > >What if $in{'NAME'} started with "../../../../tmp/"? > >Now, if in the tmp directory a

Re: cgi

2001-11-26 Thread Matija Papec
"Jon Howe" <[EMAIL PROTECTED]> wrote: >Is possible to have a cgi-perl script return the html form values + names, in the >same order in which they appearfo in the html rm supplying the post with out having >to >refer to each hash/array element. You probably have to write your own parsing rout

CGI scripts security

2001-11-26 Thread Matija Papec
I've read docs on security and I'm aware of that all user variables should be checked before doing something like opening a file, but can somebody show me how example below can compromise my website? open(F, "/home/users/me/web/$in{'NAME'}.ext"); Does something like '; rm * ;' can actually exec

'' and ""

2001-09-11 Thread Matija Papec
Is there a reason why '' should be preferred over "" when using static expressions? My guess is that "" takes a little longer at compile time for perl to see if variables resides inside quotes, but don't know if this is significant to bother with single quotes. ps. I've always used "" but now my

Re: PERL IS NOT A HIGH LEVEL LANGUAGE and What is a Script

2001-08-19 Thread Matija Papec
Jim Conner <[EMAIL PROTECTED]> wrote: >>Perl is NOT an interpreted language (such as the BASIC language I learned in >>high school, many, many years ago). > >Just a minor correction (semantics only). Perl *is* an interpreted >language where BASIC and C are compiled languages. I believe everyone

Re: arrays

2001-07-31 Thread Matija Papec
Michael Fowler <[EMAIL PROTECTED]> wrote: >> @data[0] = ("", "", ""); >> #and >> @data[1] = (1, 2, 3); > >This notation is almost certainly incorrect, what you probably meant to say >is: > >$data[0] = ["", "", ""]; >$data[1] = [ 1, 2, 3]; You're right, I wrote a wrong syntax. >> I want

Re: arrays

2001-07-31 Thread Matija Papec
Troy Denkinger <[EMAIL PROTECTED]> wrote: >which indicates that the first array is empty. The problem is the undef of >@temp. What you've put into @array is a reference to @temp. When you undef >it, you're undefing the array that the reference in array points to. > >In any event, I can't figu

Re: arrays

2001-07-30 Thread Matija Papec
John Edwards <[EMAIL PROTECTED]> wrote: >Can you explain what your trying to achieve?? > >You want an array called @data which consists of all the elements from >@dataumi2? Where does the second array with empty element values come from, >why is it needed? ok, to simplify let's suppose that @dat

arrays

2001-07-30 Thread Matija Papec
Program below works fine but I wander how to optimize this; it looks very ugly. The final result have to be @data which contains two arrays. First array have to be equal size of second array(@datumi2) and all their values have to be "". -- my $i; my (@datumi2) = (1..100); my

GD:Graph

2001-07-27 Thread Matija Papec
This is a little bit offtopic, but I'm trying to figure out how to plot this chart with graph module and it drives me nuts already :< http://www.inet.hr/~mpapec/stuff/gdgraph.gif Ok, it has two Y axis, one to the left and one to the right. White and black bars are described by left Y("cijena")

Re: question about sort

2001-07-20 Thread Matija Papec
Paul <[EMAIL PROTECTED]> wrote: >here, it's not doing anything magical. Putting parens around it and >subscripting > > ($b =~ /=(\d+)/)[0] > >means treat the resulting list of matches as an array, and give me >element zero. Thus, it's getting the first matched set of digits in $b >that follow an e

math

2001-07-20 Thread Matija Papec
I've read somewhere that perl internally uses only doubles. Does this mean that FPU is always used when working with numbers, regardless to the fact that I'm using only integer calculations? (is there a way to force internal use of integers on some variables?) -- Matija -- To unsubscribe, e-m

Re: MID in Visual Basic...

2001-07-12 Thread Matija Papec
"Sebadamus" <[EMAIL PROTECTED]> wrote: >In Visual I used the MID function to get a part of a text... por ex. "price >= 33.10" and I could get using "=" and EOL as delimiters the price "33.10" this might work: $line =~ /=\s(.+)\n/s and $price = $1; where $line is your part of text and $price is

Re: "the right way"

2001-07-10 Thread Matija Papec
Paul <[EMAIL PROTECTED]> wrote: >When it matters is when the visual appearance of your script is notably >altered. Sometimes the postfix is neater -- personally, I don't like >opening and closing a block on the same line in an if, but that's just >me... and I *do* do it when I have a conditional e

Re: "the right way"

2001-07-10 Thread Matija Papec
Jeff 'japhy' Pinyan <[EMAIL PROTECTED]> wrote: > # a flip-flop > $x = 1; > $x = !$x; # now $x is '' (which can be treated like 0) > $x = !$x; # now $x is 1 > > # another flip-flop > $x = 1; > $x = 1 - $x; # now $x is 0 > $x = 1 - $x; # now $x is 1 > >Those are the typical flip-flops I'

"the right way"

2001-07-09 Thread Matija Papec
I'm curious which of the two examples is more preferred or it depends entirely on someone style? $x = 1; #1) if ($x) { $x = 0 } #2) $x = 0 if $x; IMO first is more convenient and orthodox but that is just me. :) -- Matija

Re: Editor

2001-07-07 Thread Matija Papec
x27;t implemented, huh? Guess I'm stuck with some weird version. >-Original Message- >From: Matija Papec [mailto:[EMAIL PROTECTED]] >Sent: Friday, July 06, 2001 3:06 PM >To: [EMAIL PROTECTED] >Subject: Re: Editor -- AMD FAQ http://performancefiles.cjb.net/

Re: Editor

2001-07-06 Thread Matija Papec
anton <[EMAIL PROTECTED]> wrote: >I've listen to you all about the editors problem ? >Is anybody out there still using the old bottom-dweller vi ? > >On Fri, 06 Jul 2001 14:48:53 +0200, Matija Papec <[EMAIL PROTECTED]> wrote: >> "Aigner-Torres, Mario

Re: Editor

2001-07-06 Thread Matija Papec
"Aigner-Torres, Mario" <[EMAIL PROTECTED]> wrote: >Hi Bill, > >my choice is gnuemacs Does it support script debugging? I'm looking for nice *nix editor /debugger with breakpoints, step execution, etc. Have you tried PerlComposer? >with cperl! What is cperl? -- Matija

Re: simple regexp

2001-07-06 Thread Matija Papec
Mario Todorow <[EMAIL PROTECTED]> wrote: >perl -ne ' print "$1\n" if /\s(\d+\.\d+\.\d+\.\d+)\s/ ' file > >is better. Tnx, I'm already using something similar. Now there is another catch when I have to deal with two IPs in a single line. I have to use regexp in LIST context(i.e. @myips = $line =~

Re: simple regexp

2001-07-06 Thread Matija Papec
Matija Papec <[EMAIL PROTECTED]> wrote: >Array is a text file with lines as its elements. It looks like: > >--txt file-- ># ARIN: Aworldwidemall.com, VA - US >ALL: 63.64.190.230 ># ARIN: Aworldwidemall.com, VA - US >ALL: 67.64.190.230 >. >. >. >. &g

Re: simple regexp

2001-07-04 Thread Matija Papec
John Edwards <[EMAIL PROTECTED]> wrote: >Here's a solution I sent to the group earlier... tnx, but I used simpler regexp since IP numbers which I use are already verified as valid. >For the array thing, have you considered using a hash instead?? How do you >know where to insert the data in the ar

simple regexp

2001-07-04 Thread Matija Papec
This is pretty beginners question, how can I extract IP number from $s? $s = "ALL: 172.184.70.165 # PORT: 59" Pattern have to match four numbers separated by "." Besides I have some array and need to insert some values into it(somewhere in the middle). "perldoc -f splice" says that it only doe

whoami?

2001-06-26 Thread Matija Papec
Greetings, is there a more elegant way to find out who is running a script? %ENV is not reliable and it doesn't contain USER when booting the system, and "whoami" is external command(yuck :) ) tnx! -- Matija