Re: return value for associate array

2004-12-16 Thread Tor Hildrum
On Fri, 17 Dec 2004 15:23:35 +0800, Khairul Azmi <[EMAIL PROTECTED]> wrote: Hi, start your script with: #!/usr/bin/perl -w use strict; > sub get_conf { > my $local_file = $_[0]; > my @local_conf; local_conf is an array. An assosiative array in Perl, is called a hash. You declear it with

return value for associate array

2004-12-16 Thread Khairul Azmi
Hi, I am working on a function that would simple store value assignments statement into an array. The statement is stored in a text file. The contains of the file would be --- var word1 one,two,three var word2 four,five,six --- So I write a function that would read the file and r

Re: Resetting of the dataset

2004-12-16 Thread Lawrence Statton
> Hi! > > Yes, you are near of the truth :). But if I use some complicated joining > query to few large tables I think this is not too comfortable for the > server. > > Well, this is the line between mere programming and software engineering. The simplest technique is the most straightforwar

Re: combining getc() and unicode strings problem?

2004-12-16 Thread Jonathan Paton
Dear Tim, I think your code is on the right track, as I got a modified version of your code working. I never use getc... In C, where getc originates, the getc function returns a char type. The C char type is almost always 8 bits long. By definition it doesn't support unicode, so neither does Pe

Re: Resetting of the dataset

2004-12-16 Thread Nicolay A. Vasiliev
Hi! Yes, you are near of the truth :). But if I use some complicated joining query to few large tables I think this is not too comfortable for the server. Brian Barto wrote: I just realized I was way off base from your original question. :) You want to start over again from the beginning with fe

Using variables in REs

2004-12-16 Thread Michael Kraus
G'day... I've got a function which checks that only allowed characters are contained within a tainted piece of data, part of it looks like this: if ($tainted =~ /^([$allowed_chars]*)$/) { return $1; } Where $allowed_chars are the allowed characters. Questi

Re: combining getc() and unicode strings problem?

2004-12-16 Thread tim23456
Hello Jonathan, all > Not had the misfortune to need to play with this stuff, but I guess > the documentation for perl is a good place to start: > [snip] yes, i read these man pages more than just one time now (at different times), so i think i should have not missed anything. the perl-manpages

RE: Resetting of the dataset

2004-12-16 Thread brian . barto
I just realized I was way off base from your original question. :) You want to start over again from the beginning with fetchrow_array(). I think it's just a matter of running the execute statement again to reset it... -Original Message- From: Nicolay Vasiliev [mailto:[EMAIL PROTECTED] Sen

RE: Resetting of the dataset

2004-12-16 Thread brian . barto
I don't think there is a way to make fetchrow_array() reverse the sequence in which it delivers data. You can always store the data in a variable if you need to use it later. Otherwise, if you are receiving rows of data from the database in an order that makes it hard to work with you may want to t

RE: find sub {}

2004-12-16 Thread Bill Adams
Thanks Jonathan and Bob! From studying both your answers (for quite a while), I actually get what this code is doing. You guys are awesome. (I'm a newcomer.) Hope to give back some day... Bill -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Thursday, December 1

Re: combining getc() and unicode strings problem?

2004-12-16 Thread Jonathan Paton
Hi, Not had the misfortune to need to play with this stuff, but I guess the documentation for perl is a good place to start: perldoc perl Particularly: perldoc perluniintro perldoc perlunicode Some aspects are version dependent, so make sure your script insists on a minimum version of perl. W

RE: find sub {}

2004-12-16 Thread Bob Showalter
Bill Adams wrote: > Hi All, > > I've inherited a perl application. Can anyone explain to me the code > below, particularly "find sub {" > > find sub { $chambers{$_} = $File::Find::name . "/passwd" if -r > $_/passwd"}, @ARGV; Jonathan gave you a detailed answer, so I'll add just a bit more. Th

Re: find sub {}

2004-12-16 Thread Jonathan Paton
> Can anyone explain to me the code below ... > > use File::Find; perldoc File::Find > @ARGV = '/var/yp/src' unless @ARGV; If no files are specified, then pretend we got /var/yp/src. > my %chambers; Create a hash called %chambers. > find sub { $chambers{$_} = $File::Find::name . "/passwd" if

Resetting of the dataset

2004-12-16 Thread Nicolay Vasiliev
Hello there! I have some dataset got by the executing of some query. For example: my $sth = $dbh->prepare('select * from sometable'); $sth->execute(); Going through this dataset by $sth->fetchrow_array() I need to go back inside this proccess. Sorry, but I have no idea how can I do this. How can

find sub {}

2004-12-16 Thread Bill Adams
Hi All, I've inherited a perl application. Can anyone explain to me the code below, particularly "find sub {" TIA, Bill use File::Find; @ARGV = '/var/yp/src' unless @ARGV; my %chambers; find sub { $chambers{$_} = $File::Find::name . "/passwd" if -r $_/passwd"}, @ARGV; -- To unsubscribe, e-m

combining getc() and unicode strings problem?

2004-12-16 Thread tim23456
Hello, i have intensively searched the web for a solution on the following problem, but could not find any indication for it. The following code does basicelly nothing else then reading in a file on single char basis and writing it to a file again. The input file is encoded as UTF-8 as well as

RE: adding functionality

2004-12-16 Thread Charles K. Clarkson
Christopher Spears <[EMAIL PROTECTED]> wrote: : Here is the latest version of my script: I think you are using the wrong approach to parsing this output. You're making it a lot more complicated than it needs to be. I omitted the report and question sections. Your report data is in %licenses.

Re: How to detect present X-Server

2004-12-16 Thread Lawrence Statton
> > I'm certain that a tiny 'attempt to connect to the server on $ENV{DISPLAY} and do nothing' program can be written. > File this under "ugly but works" .. BEGIN PERL PROGRAM .. #!/usr/bin/perl use strict; use warnings; my $message = `xlsfonts -f

Re: How to detect present X-Server

2004-12-16 Thread Lawrence Statton
> > is there a way to make a perl program find out whether a > > valid X-Server is running? > > I.e. $ENV{DISPLAY} is not a dummy address, if set. > > In the situation you want to use X if available, terminal > otherwise, wouldn't it be better just to use an option? > Well -- from a human-issues

Re: How to detect present X-Server

2004-12-16 Thread Matthias Kraatz
Jonathan - thanks for the input. Actually I wanted to provide more details but I thought there would be a simple and standard solution for it (that I hadn't found.) Anyway, I am working on a project for interfacing a simulation software, creating input files, processing output, scripting varia

Re: How to detect present X-Server

2004-12-16 Thread Jonathan Paton
> is there a way to make a perl program find out whether a > valid X-Server is running? > I.e. $ENV{DISPLAY} is not a dummy address, if set. Not in a useful way. I have a headless (no monitor) Linux server, and a Windows desktop with a X win server. If I forget to run the X server it doesn't mea