Re: Hash of Arrays
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 along the regular expression, but I can't figure out what the 2 means. C:\perldoc -f split split /PATTERN/,EXPR,LIMIT 2 is the LIMIT. It makes sure that $line wont be sliced in more then two parts. If LIMIT is omitted, $line get splited on every /PATTERN/ occurrence. -- 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 figure out Error.pm
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 DBException; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: naming subroutine reference parameter?
Jeff Pan wrote: my (%hash,@array); sub_test(\%hash,[EMAIL PROTECTED]); has special meaning so it should be dropped when not needing particular special behavior. I can't understand for this,can u give me some examples? perldoc perlsub -- NAME(LIST); # Circumvent prototypes. NAME; # Makes current @_ visible to called subroutine. Use only when you want described side effects. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: infile data
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('',(DATA)); #more efficient my $sql = do { local $/; DATA }; check perldoc perlvar if you want to know more about $/ __DATA__ select . Is there any way to do this twice? To define two sets of static SQL? I guess that you don't really want to read two times from DATA but to somehow separate text below __DATA__ (undef, my %static_sql) = split /#(\w+)\s+/, do { local $/; DATA }; use Data::Dumper; print Dumper \%static_sql __DATA__ #select1 select * from table1 .. #select2 select * from table2 .. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: naming subroutine reference parameter?
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 (%hash,@array); sub_test(\%hash,[EMAIL PROTECTED]); has special meaning so it should be dropped when not needing particular special behavior. sub sub_test{ my ($hash_ref,$array_ref)[EMAIL PROTECTED]; ok. my %hash=%$hash_ref; my @[EMAIL PROTECTED]; This isn't needed actually and it only makes unnecessary overhead as keys/values are copied, so you immediately lost benefit by passing by reference. It's better to access them directly like, $hash_ref-{key} $array_ref-[0] do something... } -- 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 do you force SOAP::Lite to use document/literal SOAP messages?
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 there any way of telling? Or, even better, is there a way to force the SOAP::Lite module to use document/literal messaging? There is documentation that comes with every module, always check documentation first. http://search.cpan.org/~byrne/SOAP-Lite-0.60a/lib/SOAP/Lite.pm#INTEROPERABILITY -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting the value of a var
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. Please help me. If everything fails you can access package variables via symbol table, #symbol table my $st = eval '\%$module::'; # scalar reference $sref = *{ $st-{content} }{SCALAR}; print $$sref; perhaps you could rearrange your problem so it wouldn't use such access to globals? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: getting the value of a var
#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] http://learn.perl.org/ http://learn.perl.org/first-response
Re: Analyze Log
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 as the key and column 5 (7338 in this example) as the value. There will be lots and lots of lines hence me using foreach. This is how I am attempting it: #!/usr/bin/perl use Data::Dumper; @tmp = `cat /usr/local/apache/logs/tmp`; foreach (@tmp) { if (/(^.+(\.net|\.uk|\.com|\.org))(\t[a-z0-9]{9})(\t[a-z0-9]{9})(\t[a-z0-9]{9})(\t[a-z0-9]{9})/) { $bw_usage{$1} = ( $6 ); } } print Dumper \%bw_usage; Firstly, please don't laugh at my code too much! :o) Now I thought this I think, keep it simple is a key rule most of the time. :) If you have tab separated values, then spliting on \t should be very straightforward, #untested my %bw_usage; for my $line (@tmp) { my ($k, $v) = (split /\t/, $line)[0,4]; #domain test? next if $k !~ /\.(net|uk|com|org)$/i; $bw_usage{$k} = $v; } print Dumper \%bw_usage; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: __DATA__ Token Problem
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 DATA so that the __DATA__ section is empty? What did you try so far? :) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/ http://learn.perl.org/first-response
Re: A few questions
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 the gui from updating. To launch another app you should fork and then exec the other app without waiting your the child to die. I guess another way is to somehow force gui updating? return(*DAT); # or should be return(DAT)? } Is this kind of using file handles encouraging? You are probably better served by using the IO::File module. See perldoc IO::File for more information. tnx. -- Is there a way to use 'format' where I could write to scalars instead to file handles?(usefull when cgi sends mail and shows same content in the browser) I assume you are referring to the write function and formats. I believe yes. there is a way to get at the Perl variables used to do the formating, but that is ugly (see perldoc perlvar for more info). Is there a reason you are not using sprintf (see perldoc -f sprintf)? Actually there isn't a strong reason for format, I just thought the code would look more cleanly. -- How to match complex repeating patterns, i.e. I want to match (\d{6}.*?\t) ten times and read values of the last three? Here is one way: code #!/usr/bin/perl -w use strict; my $string = ab cd ef gh ijkl mn op qr st uv wx yz; my @matches; for my $i (0..9) { last unless $string =~ /(\w+)/g; $matches[$i] = $1; } my @I_care_about_these = @matches[-3,-2,-1]; #note, if there are less than three matches #we will get a warning here print @I_care_about_these\n; /code This should print out qr st uv\n Tnx, I was using split but thought that single regex would be more optimized and shorter for this kind of task. :) -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
A few questions
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 function which should return file handle: F = LockFile('/some/file', 0); . . close(F); ## sub LockFile { my($file, $pos) = @_; local *DAT; open DAT, +$file; #flock and seek to $pos . . return(*DAT); # or should be return(DAT)? } Is this kind of using file handles encouraging? -- Is there a way to use 'format' where I could write to scalars instead to file handles?(usefull when cgi sends mail and shows same content in the browser) -- How to match complex repeating patterns, i.e. I want to match (\d{6}.*?\t) ten times and read values of the last three? -- This is SQL(mySql) question but hopefully there is some simple solution to it. Table look like: NAME | EMAIL dave | [EMAIL PROTECTED] john | [EMAIL PROTECTED] mary | [EMAIL PROTECTED] I want to extract john's EMAIL using 'john236' as a search string. Unfortunately RLIKE doesn't work here SELECT EMAIL from Table WHERE NAME RLIKE 'john236'; and SELECT EMAIL from Table WHERE 'john236' RLIKE NAME; is not recognized as a valid sql query. :! -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: CGI scripts security
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 link was created with that file extension, then they could open anything according to your scripts permissions. Scary, but not far fetched - it's a frequently exploited idea. That's true but this is not of my primary concern(there are no crackers with telnet access to the site :)). I'm thinking more of other scary possibility, that web visitors can execute commands abusing ';' or '|'. Does something like '; rm * ;' can actually execute? (note suffix '.ext') Not in this instance, $in{'NAME'} must result in a string, Yes %in is filled with parsed user variables, so I'm safe than, huh? :) it can't magically turn into a subroutine call... unless it's a tied hash - which you'd definately know about. No, actually I don't, could you point me somewhere to perldoc? At the top of your script use: #!/usr/bin/perl -wT This code won't even work, since it'll be reported as insecure. When you've worked that bit out, you'll be back for a way of untainting your data ;-) We'll be waiting! Tnx, I've read somewhere about -T switch but right now don't have time to toy with, variable filtering works nicely. -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
CGI scripts security
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 execute?(note suffix '.ext') tnx! -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: cgi
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 routine, something like sub parse_form_data{ my (@p, $input, $pair, $field, $value); if ($ENV{'REQUEST_METHOD'} eq GET) { $input = $ENV{'QUERY_STRING'} } else { read(STDIN, $input, $ENV{'CONTENT_LENGTH'}) } foreach $pair ( split(//, $input) ) { ($field, $value) = split(/=/, $pair); $field =~ s/%([\dA-Fa-f]{2})/pack(C, hex($1))/eg; $value =~ tr/+/ /; $value =~ s/%([\dA-Fa-f]{2})/pack(C, hex($1))/eg; push @p, $field, $value; } return(@p); } #and then call @data = parse_form_data; If someone knows in which order are hashes loaded I would also like to know. An example of what I am Woking with : ## /usr/bin/perl -w use CGI_Lite; $cgi = new CGI_Lite (); %data = $cgi-parse_form_data (); @data = %data; open(SENDMAIL, |/usr/lib/sendmail) or die can't fork for sendmail: $!\n; print SENDMAIL EOF; From: blah To: blah Subject: STUFF @data EOF close(SENDMAIL) or warn its all GONE WRONG!!!; # I could reefer to each element of %data $data{whatever value} individually but this seems a bit laborious. It would be nice to have a ordered array I could pass straight out. -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
'' and
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 boss tells me that this is a bad thing :) -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: PERL IS NOT A HIGH LEVEL LANGUAGE and What is a Script
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, including myself, got the idea though. I just wanted to make clear the words used between the two. Interpreted meaning that the script/program is interpreted and compiled at run time by the compiler (the Perl binary) and then run. Whereas BASIC, C, C++, COBOL, FORTRAN, etc, etc are all compiled into machine language. At runtime the OS knows how to run the program and is therefore *not* interpreted but simply run. Well, not quite. First incarnations of BASIC were interpreted, there was no compiler for them so you couldn't do binary executable. As a matter of fact, you could't know if BASIC program is syntax error free until interpreter wasn't hit by offending piece of code(i.e. Locomotive BASIC on Amstrad CPC464 ;-) ). On the other hand, Perl couldn't be referred as a interpreted language[1] because he simply isn't. IMO, if we were into making an appropriate term it would be more like compile at runtime language(like C or any other with one downside? where compiling is done many times). [1] by interpreted I mean translated and executed line by line, by some kind of program -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Netscape 4.xx and caching problem
Greetings, I have a script which draws some graphs and everything works fine, except I have to push reload in browser every time to get a valid picture. So far I used these headers but with no luck. Browser is Netscape 4.xx under Linux. print Content-type: image/png\n; print Pragma: no-cache\n\n; print Content-type: image/png\n; print Cache-Control: max-age=1, must-revalidate\n\n; -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: arrays
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 figure out why you'd want to do what I think it is you're trying to do. There certainly may be a vaild reason for it, but there may be a better solution. Can you say what it is you're trying to accomplish? I'm working with Gd::graph::bars module and want to hide all values on X axis. Since I didn't find appropriate attribute for such thing, thought that array of empty strings is good idea. -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: arrays
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 to make @data[0] on the fly without for structure and it should have the same number of elements as @datumi2. Your restriction that it not use a for loop to construct the data is needlessly limiting. There are several ways to do what you ask, one of them is a for loop. I didn't like idea where for is used for adding elements one by one.. otherwise I don't have anything at all against using it. ;) push(@{ $data[0] }, ) for (0 .. $#datumi2); OR push(@{ $data[0] }, ) for @dataumi2; Does $_ change in these two examples? (due cycling trough @datumi2) $data[0] = [() x @datumi2]; Each has strengths and weaknesses. Can you explain where are these strengths(which one is the fastest?) -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
arrays
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 (@temp, @data); # block for optimization for $i (0..$#datumi2) { push @temp, } push @data, \@temp; undef @temp; # end of block for optimization push @data, \@datumi2; . . . -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: arrays
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 @datumi2 = (1, 2, 3); #so final result should look like this: @data[0] = (, , ); #and @data[1] = (1, 2, 3); I want to make @data[0] on the fly without for structure and it should have the same number of elements as @datumi2. This may look somehow silly but I'm working with GD::Graph module and want to avoid X values being drawn, so there is a need for array where all elements are . -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GD:Graph
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) and little darkblue bars by right Y(volumen). If you have some experience with gd:graph or some suggestions, please speak. :) -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
math
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-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about sort
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 equal sign. Isn't this array thing redundant in this case where we only take zero element? (I can only think of forcing a particular context with such action) -- Matija -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MID in Visual Basic...
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 price. -- Matija
Re: the right way
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've seen. I can't see if ($x) { $x = 0 } having much of a purpose unless there was some else { ... } clause attached to it. If there's no else { ... } clause, you could just write $x = 0; and be done with it. A was thinking more about structures rather then $x manipulating, but this is also nice to know. -- Matija
Re: the right way
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 else, and both are just one line. if ($x) { y() } else { z() } though usually they're long enough that I drop them to seperate lines. if($x) { x() } elsif ($y) { y() } else { z() } I don't like that structure, either, and often rewrite it with a trinary: $x ? x() : $y ? y() : $z ? z() ; But what counts most (aside from making it do what you want) is that you can read it, that you can read it and edit it without a headache in six months or a year, and that the next guy can read it and edit it without having to come beat you up. =o) lol, yes, you always have to make compromise between readable and all-in-one-line code. Btw, when we talk about structures is there something like switch in perl which could replace following code? $x==1 and $y = 1; $x==2 and $y = 2; $x==3 and $y = 3; I like postfix conditions whenever I can use them, but I like them best when I have a complex condition that has optional parts: if ($x) { x(); # doesn't execute unless $x y() if $y; # doesn't execute unless $x *AND* $y } y() is ideal for a postfix, because all other conditions have already been tested; this keeps the program from suffering excessive indentation caused by another block of curlies, though with such a Yes, although I like conditions on the first place thus, y() if $y; could be replaced by: $y 0 and y(); So, to answer your question, it depends largely on the code your writing, but mostly on someone's style. tnx. -- Matija
the right way
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
Wine, Michael [EMAIL PROTECTED] wrote: YES! Try http://www.vim.org for a 'vi on steroids'... If you area vi freak, you'll love vim! :) Somehow it isn't my favorite, besides it says that syntax coloring :syn-on isn'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: simple regexp
Matija Papec [EMAIL PROTECTED] wrote: cut 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 . . . . # ARIN: Aworldwidemall.com, VA - US ALL: 163.64.190.230 --txt file-- Array is already sorted by IP, so I have to insert a new record somewhere(i.e. 65.64.190.230 between 1st and 2nd record) and write a whole array back to the file. How about this, it isn't fastest option but it seems very elegant: @array = (0..7, 9..15); @cutoff = splice (@array, 8); # @array is now (0..7) push (@array, 8); # adding new element @array = (@array, @cutoff); # @array is now (0..15) -- Matija
Re: simple regexp
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 =~ /(blahblah)/g ) in order to evaluate second blahblah from $line. If I use $1 and $2, *only* $1 get filled, don't know why.. -- Matija
Re: Editor
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: Editor
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 [EMAIL PROTECTED] wrote: Hi Bill, my choice is gnuemacs Does it support script debugging? I'm looking for nice *nix editor -- Matija
simple regexp
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 does replacement and truncation. Do you guys have some idea how to make this work? tnx! -- Matija
Re: simple regexp
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 array? Is it needed after another value, or at a certain element?? 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 . . . . # ARIN: Aworldwidemall.com, VA - US ALL:163.64.190.230 --txt file-- Array is already sorted by IP, so I have to insert a new record somewhere(i.e. 65.64.190.230 between 1st and 2nd record) and write a whole array back to the file. -- Matija
whoami?
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