Hi list,
I'm trying to use eval () with a constants module and it works very
funny, can anyone explain this behavior to me. It seems to me as this is
a scope thing. If i remove the 'my' it works fine but i can't see why it
shouldn't work with my:
i have a module with constants (constants.pm):
##
Have you tried CPAN.pm?
/Jon
Daniel Falkenberg wrote:
>
> Hello All,
>
> I don't know if this is possible but I want to be able to have a Perl
> script check my server for modules that I need in my script. If the
> modules don't exist.
>
> Is there a module that does this or similar?
>
> Re
i bet there's way of doing this on one line:
my $a = '"one two" three "four five six" seven eight nine';
my @ar = ($a =~ /((?:\"[^\"]*\"|[^\s]*))\s?/g); #should be possible to
remove "
s/\"//g foreach (@ar);
print "$_\n" foreach (@ar);
/Jon
Pete Emerson wrote:
>
> I'd appreciate it if someo
You can if the database is accessible from the webserver.
Read about apache (www.apache.org) and perl (www.perl.org), especially
the modules CGI.pm and DBI.pm.
/Jon
Allison Davis wrote:
>
> Can anyone tell me if you can have all the members of our origanization
> access our database on the web
Lance Prais wrote:
>
> #open a file with the filehandle
> open WORKFLOW, "..\\..\\workflow.txt" or die "Cannot open Workflow $!\n";
> my $data = for (1..21);
> while # loop through the workflow.txt
>
> chomp; #a)
> my $line=$_;
> print STDERR "\nline: $line";
> }
>
> The above code
Hi,
some alternative approaches would be:
my $res = `$cmd`; # note that it's not "'" but "`"
# $res only stdout, this will puke out stderr
or
my $res = `$cmd 2>&1`; # redirect stderr to stdout
# $res is now both stderr and stdout
or
my $res = `$cmd 2>/dev/null`; # throw away stderr
# $res
stat is what you want, 'man perlfunc'.
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
/Jon
Michael Pratt wrote:
>
> Hello,
>
> How do I get a file date time stamp?
>
> Thanks
> Mike
>
>
check man perlrun
im not sure what you're after, if it's just grep i'd suggest
find . -type f -exec grep foo {} \;
if you wanna do something about foo
find . -type f -exec perl -pi -e 's/foo/bar/g' {} \;
/Jon
"Thomas S. Dixon" wrote:
>
> Greetings gurus,
> I've worked with perl somewhat for
read
perldoc -f substr
/Jon
Jorge Goncalvez wrote:
>
> Hi, I wanted to have the first 5 elements of a scalar, like for exemple:
> my $number= E14011
>
> my number2=E1401
>
> How can i do this in Perl, thanks?
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e
perldoc -f length
:)
/Jon
Jorge Goncalvez wrote:
>
> How can I count the number of characters of a string ?
> Thanks
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands,
Michael Pratt wrote:
>
> I cant seem to get the ARGV to work right via web I get not found error but
> it works via command line. whats the trick?
>
> It works if I do this get_file.pl test1.txt test2.txt
>
> but it wont work via http://www.host.com/cgi-bin/get_files.pl test1.txt
> test2.txt
>
Prasanthi Tenneti wrote:
>
> hi,
> how to remove a line from a file?
> pls help me.
press the delete key repetedly? :)
but really, i think you'll need to give som more info. what line? first
line, last line, random line, line nbr n?
would this be it?
my $line_to_delete = 7;
open (F, 'some_fil
Hi Stanislav
i searched with google for Device::ParallelPort and came up with this:
http:[EMAIL PROTECTED]/msg05952.html
i was too lazy to register at
https://pause.perl.org/pause/authenquery?ACTION=edit_mod
as the post requests though, might be something for you?
It'd be nice to hear about y
"Hubert Ian M. Tabug" wrote:
>
> Hi,
>
> Given that I have a perl script main.pl, and I want main.pl to "use/call"
>the script >testprog.pl, and store testprog.pl's output into a variable that can be
>used within main.pl. >How do I go about doing it? Your help would be greatly
>apprec
Mark-Nathaniel Weisman wrote:
>
> Hello all,
> Sorry about re-hashing old things here, however I've looked through
> the older messages and can't seem to come up with an answer. How can you
> pull a server based date and time stamp from within a script? Any help
> would be greatly appreciated.
"John W. Krahn" wrote:
>
> Gary Hawkins wrote:
> >
> > How can I clear a line before replacing it?
> >
> > Am doing \r and overwriting, but sometimes the text that was there previously
> > is longer than the new text.
>
> Pad the shorter lines with spaces. For example:
>
> printf "\r%-20s", $s
Manish Uskaikar wrote:
>
> Can anyone tell me if i can use threads in perl; If yes then what all library files
>i have to include. Also tell me how i include a system library file like "math.h" or
>"unistd.h" in perl. How can one include "C" libraries in perl program i.e.. *.pl
>
> Regards
>
Stanislav Zahariev wrote:
>
> Hello,
> I'm searching for a perl book to buy... But I'm not sure which is the best, or
>which are the best. Can you refer me some so I can chose from them? I know the basic
>things of perl, if the book holds them they must be very detailed. I'm oriented in
ng lines. Also, perhaps
you saw that i sent a link with many books?
/Jon
>
> Take a look at the FAQ section 2.3, bullet point 1 and chill out.
>
> /John ;)
>
> -Original Message-
> From: Jon Molin [mailto:[EMAIL PROTECTED]]
> Sent: 07 January 2002 16:32
> To
Ahmed Moustafa wrote:
>
> Hi All,
>
> My data structure is a hash of a hash of an array. I build it from an
> input file by the following code. Could you help me write it back to an
> output file, please?
>
> # Code Begins
> %data = ( );
> open (IN, "in.txt") || die;
> while () {
> chop;
>
You need to call $handle->quit ();
/Jon
Cabezon Aurélien wrote:
>
> Hi list,
>
> I'm playing around Net::POP3.
> I wanna make a script that is able to check for pop3 mail and then save them
> in a MySQL database (not implemented yet, usefull for mailing archiving)
> I'm at the start of the sc
"Hanson, Robert" wrote:
>
> It sounds like you might have multiple spaces between some elements.
>
> Try this...
>
> @date = split(/\s+/,$date);
but it will also split on \n,\t so / +/ would be better if it's just
space you wanna split on
/jon
>
> This will split on one or more spaces.
Karsten Borgwaldt wrote:
>
> Hi all,
>
> can anybody tell me, why I can't push any read values into an array?
>
> my code is:
> ..
> ..
> ..
> opendir(IN, "some_path") || die "opendir: $!";
> rewinddir(IN);
> while (defined($_ = readdir(IN)))
> {unless (m/^\.{1,2}$/ or not m/'.foo'$/) # all f
Take a look at 'perldoc CGI.pm'
Perhaps you should buy a book as well? Or read the online documentation?
I can recomend 'learning perl'.
/Jon
kondreddy Rama koti Reddy wrote:
>
> Dear Friends,
> can u tell me, how can i create an executable
> file for the .cgi program on linux whihc
> is having
[EMAIL PROTECTED] wrote:
>
> Try this:
>
> #!/opt/local/bin/perl
> #!/usr/bin/perl
> my $A="a";
> for(0..285074){
> $A++;
> print" $A:";
perhaps you should consider NOT printing that 285074 times? would kinda
flood the term :)
> }
> print"\n\n$A\n";
>
> --
I'm not sure I really understand what you're after, i get the feeling
you're normaly using windows. If you set the mod to 755 (rwxrxrx) the
perlscript will be executable, there's no need t compile it with perlcc.
If it's speed you're after, you should use mod_perl instead
(perl.apache.org) as th
here are two ways:
my $exit_code = system ($cmd);
system ($cmd);
print "exit code = $?\n";
/Jon
Ahmed Moustafa wrote:
>
> Hi All,
>
> I'm calling a Java application using "system". How can I know the return
> code of the called Java application?
>
> Your help will be appreciated so much.
>
Hi list,
I've got a pretty hairy regexp that hangs and i can't really understand
why. It works just fine one my freebsd workstation running 5.6.1, but in
linux with 5.005_03 it just dies.
here is the code:
$rule = "A. TRAVEL ON BB CODESHARE ABTS BB1000 - BB7999 AND
BB9000-BB NOT PERMITTED
B.
have
BEGIN
{
open (STDOUT, '>>/some/log/file')
}
if you want it to file
otherwise do,
open (STDOUT, "<&STDERR");
and with shellstuff, > redirects stdout, 2> redirects stderr so
system ("ls /apa >/dev/null 2>&1");
redirects both outputs to /dev/null
is that what you wanted?
/Jon
Alex Harris
Read 'perldoc DBI'
As a convenience, if the $data_source parameter is
undefined or empty the DBI will substitute the value
of the environment variable DBI_DSN. If just the
driver_name part is empty (i.e., data_source prefix is
'dbi::') the e
if you aren't interesed in weather it works or not, why not try
system("/usr/local/bin/scp file $system:/home &");
/jon
lospalomares wrote:
>
> I am trying to scp a file to various systems, but the
> script hangs if the scp command to one of the systems
> fails. Is there a way in perl to spe
did you try at cpan?
http://search.cpan.org/
/Jon
richard noel fell wrote:
>
> I have been unable to find a source for the tk module. My google
> searches have been fruitless. Does anyone have a pointer to a tk.rpm for
> redhat linux 7.1?
> Thanks,
> Dick Fell
>
> --
> To unsubscribe, e-mail:
Jorge Goncalvez wrote:
>
> Hi, I have this:
> #!/usr/local/bin/perl -w
> use Win32::Registry;
> my $Register ="Software";
> #my $Register2=".DEFAULT\\Software";
> my $hkey;
> my @array= qw($HKEY_LOCAL_MACHINE $HKEY_CURRENT_USER ) ;
>
> foreach (@array)
i don't know this windows module but i gue
bc wrote:
>
> hello
>
> i have a flat file (csv) [it has about 114 rows]
>
> i want to put the word "insert " in front of each row,
>
> how it the "for each" writtin? in other words, in perl, how do i do a for each row
>insert the word "insert ", then it comes out of the "for each" loop thin
Morgan Norell wrote:
>
>
> Can anyone give me some hints how to do this I'am totaly lost.
>
read about files and regexps. There's a good book called 'learning perl'
you should check out. If you're not interested in buying books, check
the online info and perldoc.
If you're not interested in l
Darryl Schnell wrote:
>
> This may not be the place to ask this question so forgive me. I know a few people
>who are obsessed with the way their perl code is formatted and I was wondering what
>does actual good readable perl code and bad formatted perl code look like?
>
> I usually have my co
or do:
print "Content-type: text/html\n\n";
/Jon
John Edwards wrote:
>
> This looks like your script isn't returning the correct HTML headers. It's
> not a database connection fault. I would strongly suggest using the CGI.pm
> module. This provides an easy interface to all things CGI.
>
> All
You have the best(tm) webserver out there: www.apache.org, you can add
mod_ssl to it and there you go.
An alternative could be http://www.apache-ssl.org/ (not the same as
apache with mod_ssl)
/Jon
Gary Hawkins wrote:
>
> CommerceSQL uses Perl and needs https, secure server. I already asked
Michael Pratt wrote:
>
> This is what I want to do and I dont know where to start:
>
> List files in a directory taking that list with just the filename and no
> other information. using that information and populating a listbox.
Check out 'perldoc -f opendir perl'. Perhaps the File:: modules s
Kevin wrote:
>
> Hi
>
> I have a really simple problem that I could solve easily with a strstr() call
> in c but cannot get my head around in perl.
>
> I have have the following input.
>
> Active Accounted actions on tty57, User fred Priv 1
> Task ID 35176, Network Accounting record, 02:04:00
I'm not sure i follow you but if you use localhost or leave the host
blank it'll try localhost...
/Jon
Jefferson Ryan Lee wrote:
>
> Hi,
>
> Are there any way to access a database (SQL Server) not using the ODBC?
> It is possible for a perl script to query a database not on a local
> m
I guess geoff is in the ma-linux list, not in here since the only things
i can find in this thread is 3 posts by you. Kinda hard to offer
better(tm) sollutions when you don't know what's been suggested
before...Perhaps you should try NOT cross-posting?
/Jon
[EMAIL PROTECTED] wrote:
>
> Thanks t
it's pod, do 'perldoc module' and 'perldoc perldoc'
/jon
Ron Goral wrote:
>
> I have a very beginner's question. I've just been looking at the code for a
> library file and noticed some, to me, very peculiar things. First, there is
> text that is not commented, it is just typed in place. Why
use BEGIN:
perl -e 'BEGIN {if (`pwd` =~ /some_path/){use lib ("/usr");}else{use lib
("/home");}}'
i usually unshift @INC but i've heard that's not a good way to do it,
not sure why though.
/Jon
"Kingsbury, Michael" wrote:
>
> I want to have two different variable for use lib depending on a cm
"Steven M. Klass" wrote:
>
> Hi all,
>
> Here is the general problem. I have a file that I need to edit but can't.
im not sure i follow you here, making a backup copy is not an option?
perl -pi.bak -e 's/foo/bar/g' weird_uneditable_file;some_app
weird_uneditable_file;mv weird_uneditab
[EMAIL PROTECTED] wrote:
>
> I was happily programming, getting close to the end of my project just trying
> to figure out table placement in html within my largest function on the page.
>
> All of a sudden my function won't function! I didn't change any of the perl
> code! And it was fine exc
There's some good documentation about this at:
perldoc -f chmod
/Jon
Roman Hanousek wrote:
>
> I can't remember how, But how do i change the attribute of a file from read
> only to writable and then back gain.
>
> Thanks
> Roman
>
>
Naika - EV1 wrote:
>
> Bare with me but I'm a beginner and new to this list.
>
> I need advice on poll results. What should I be researching? I have forms
> submitting off websites and I can direct them to email the results but how
> do I write them to a file to be redisplayed on a webpage? A
Frank wrote:
>
> On Wed, Feb 13, 2002 at 01:17:50PM +0100, Andrea wrote:
> > In article <[EMAIL PROTECTED]> wrote
>"Jeff 'Japhy' Pinyan"
> > <[EMAIL PROTECTED]>:
> >
> > >>I have a set of functions that give numeric results, and I need to compare them
>and choose the
> > >>maximal value. Is th
Susan Aurand wrote:
>
> What is the fastest or best way to sort a file alphabetically, the
> rewrite it to a file.
>
you'll print this very fast anyway :)
sort file > temp_file;mv temp_file file
/Jon
> Thanks
> Susan
> Haywood County Schools
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTE
rory oconnor wrote:
>
> I am using LWP to hit a page and save the source to a file. But before
> it saves it I want it to strip out the client id from the urls. They
> are always in the same format:
>
> client=& # 8 digits and then ampersand
>
> so what I want to strip out is stuff l
sorry about that answer, too early in the morning to answer
questions...i even thought it was the newest.
I wish I could go back to sleep
/jon
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Try removing all cookies you have in your browser and set it to ask for
allowing cookies, then you'll really see if there are any cookies
/Jon
Tanton Gibbs wrote:
>
> Ok, I'm having a problem downloading a .zip file from a webpage. If I type
> in the filename in the browser URL textbox I get r
This smells homework!
/jon
Bruce Ambraal wrote:
>
> Hi
>
> I have done (b) for coding see below, could someone assist with
> (a) (b) (d)
>
> #!/usr/local/bin/perl -w
> my $num_rows;
> my $i;
> my $r;
>
> $num_rows = ;
>
> for ($r = 1; $r <= $num_rows; $r++)
> {
> for ($i=1; $i<=
The first couple of hits seems relevant, look there.
http://www.google.com/search?hl=en&q=CGI.pm
also, in the future send cgi questions to the cgi list
/jon
James Kelty wrote:
>
> Hello,
>
> I have read the CGI.pm documentation that comes with the distibution, but I
> can't find any refer
"Dennis G. Wicks" wrote:
>
> Thanks! That works great!
>
> But!!!:
>
> [root@iodine root]# man perlvars
> No manual entry for perlvars
> [root@iodine root]# perldoc perlvars
> No documentation found for "perlvars".
> [root@iodine root]#
>
it's perldoc p
is this homework? Your other posts looks very homeworkish...
/jon
Bruce Ambraal wrote:
>
> Hi
>
> How do you do it
> Give me two different methods in subroutines, that will:
> match together all of its parameters into on large list.
>
> Many thanks to the following people: Brett, Micheal F,
kitti wrote:
>
> how to convert array to integer
>
> $array[0]=5
> $array[1]=6
> $array[2]=7
> $array[3]=8
>
one way to do it is:
my @array = (5, 6, 7, 8);
my $some_val;
$some_val .= $_ for (@array);
another is:
my @array = (5, 6, 7, 8);
my $some_val = "@array";
$some_val =~ s/[^\d]//g;
a
anthony wrote:
>
> Hi,
>
> I have an upload script, and i want to check the file size before it
> uploads.
>
> Any suggestion is appreciated
>
> Anthony
>
here's some old code that does that, might be something built-in in
CGI.pm as well:
my $tempFile = CGI::tmpFileName($img_filename);
Rahul Garg wrote:
>
> Well, I also dont know whether its possible or not ?
> Any suggestions.
>
I hope you won't keep replying to your own question every second hour,
saying that you don't know the answer
/jon
> - Original Message
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
svensson wrote:
>
> Is there any way I can have a script producing a bit of html code on a
> remote computer
>
> and then be able to make a call to that in a HTML document which then will
>
> similair to http://something.com/xx.cgi?sdfsdfsdf";>
>
> If it can be done let me know how
yes it is.
l module for things like that. get the html and
merge it. otherwise i'd go for a frame
the cgi list is here:
http://lists.cpan.org/showlist.cgi?name=beginners-cgi
/jon
> "Jon Molin" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED
Iain Wallace wrote:
>
> Hi,
>
> I was wondering if any one can help me. Is there any command in perl that will let
>me match a line only if the next line
> fufills a certain condition, without doing a double loop over the file?
> My data is like this
>
> Variable1 number number number
> Variab
4Hi list,
I've been trying to install Crypt::RSA for a couple of hours now and
I've run out of ideas.
perl Makefile.PL and make runs smoothly but make test shows this:
PARI: *** precision loss in truncation at
/usr/lib/perl5/site_perl/Crypt/Primes.pm line 580.
on that line of Crypt::Prime
Jon Molin wrote:
>
> Hi list,
>
> I've been trying to install Crypt::RSA for a couple of hours now and
> I've run out of ideas.
>
> perl Makefile.PL and make runs smoothly but make test shows this:
>
> PARI: *** precision loss in truncation at
>
Hi list!
I've always thought there's a difference between for and foreach, that
for uses copies and foreach not. But there's no diff is there?
my @a = (1, 2, 3 , 4 , 5);
$_ += 2 for (@a);
print "@a\n";
3 4 5 6 7
my @a = (1, 2, 3 , 4 , 5);
$_ += 2 foreach (@a);
print "@a\n";
3 4 5 6 7
why isn
Jan Gruber wrote:
>
> Hi, Jon && list !
> On Friday 01 March 2002 11:29 am, you wrote:
> > Hi list!
> >
> > I've always thought there's a difference between for and foreach, that
> > for uses copies and foreach not. But there's no diff is there?
>
> AFAIK there's not really a difference between
"John W. Krahn" wrote:
>
> Jon Molin wrote:
> >
> > Jan Gruber wrote:
> > >
> > > Hi, Jon && list !
> > > On Friday 01 March 2002 11:29 am, you wrote:
> > > > Hi list!
> > > >
> > > > I've a
norishaam wrote:
>
> Hi,
> I've been trying to figure out the above, maybe someone has some
> experience...Below is the scenario:-
>
> 1. I have an executable, update.exe, that can run locally to update the
> service pack.
> 2. I am trying to write a perl script to have this update.exe t
Dave Adams wrote:
>
> Hi there,
>
> I have a problem which I would like to use perl to resolve, however I'm not
> sure if it is possible to do.
>
> I need to scan a file and check some conditions, first if field 9 is
> duplicated on 1 or more rows, then I need to check field 10 to see which is
Tor Hildrum wrote:
>
> #!/usr/bin/perl -w
> use strict;
> use warnings;
>
> print "What file do you want to open?\n";
> chomp(my $openfile = );
> print "What file do you want to write to?\n";
> chomp(my $outfile = );
> print "What do you want to replace in the first file?\n";
> chomp(my $pattern
The data is in the %ENV hash, the key is QUERY_STRING but it only works
with GET and can give you some problem with GET as well. What I'd
recomend is some reading about the CGI module, either the 'perldoc CGI',
online info or the chapter about cgi in learning perl.
/Jon
farshad fekri nejat wro
tom poe wrote:
>
> Hi: I have a script that connects to my PostgreSQL7.0.3 OK.
>
> Now, I also have text files that contain:
> column_name: data
>
> I want to open the database, open the file, read each line that has a
> column_name followed by a colon and space, then the data, and move it
> t
"Daniel J. Tomso" wrote:
>
> Greetings.
>
> I'm matching a pattern against a long string, and I want to examine each
> occurrence of the match. I know that $& stores the match, but is there
> a way to store EVERY match in the string, and then look at them?
>
> Example:
>
> $str = "This is a v
walter valenti wrote:
>
> Hi,
>
> i've got a binary executable file, that give a result on STDOUT (shell).
> I'm reditected STDOUT on a file as:
>
> use Getopt::Long;
> open(STDOUT,">/usr/local/netsaint/var/tmp") || die"$!\n";
> &GetOptions("p=i" => \$port);
> $|=1;
> system("/usr/local/netsain
Derrick Wippler wrote:
>
> Can anyone tell me why " print $rec->[4] " prints
> but print "$recs[0]->[4] does not print a thing ?
>
> I've confimed the data, the first row in the fourth column is an "F"
> $rec->[4] prints it, but $recs[0]->[4] does not !!! ARG @#@!#!!!@@!!@!!
> PS: I'm us
"Mohammed A. Hassan" wrote:
>
> Well , I want to do this this on UNIX
>
> "Jan Gruber" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > Hi !
> >
> > On Wednesday 06 March 2002 09:21 am, you wrote:
> > > How can I scheduler a cgi script?
> >
> > Depends on t
Jenda Krynicky wrote:
[snip]
>
> You could use fetchall_arrayref(), but I would not recomend doing
> that unless you are really sure the resultset is small enough. That
> would slurp all the data to memory of YOUR process with quite
> some overhead.
>
Are there any benchmarks on this? Becouse i
Anette Seiler wrote:
>
> Hi Ken,
>
> I encountered exactly the same problem today: How to read a file
> AND change something in it? I was not able to do both of them at
> the same time.
>
> I am sure there is a more correct way to do it, but my solution (in
> the spirit of TIMTOWTDI) was to wri
Troy May wrote:
>
> Hello,
>
> How do you write to the beginning of a file? I see only 3 options to open a
> file: to read, to overwrite, and to append to the end of the file.
>
If you think about the file as an array with one char on each index:
my @string = split (/|/, "this is a test");
n
FORIZS Zsolt wrote:
>
> How do i delete some words in a string, like with SED in Unix.
>
> please give me some ideas.
use a regexp as in sed
my $string = "this string sucks";
$string =~ s/sucks/blows/;
look at 'perldoc perlre'
/jon
>
> cu zsolt
>
> --
> To unsubscribe, e-mail: [EMAIL PROT
Gary Stainburn wrote:
>
> Hi all,
>
> I've got a project where I need to develop an single-board-computer based
> network device using packet modems connected to Amateur Radio equipment and
> I'm trying to develop a simulator in Perl under Linux and I've got a few
> questions.
>
> Basically I'm
Gary Stainburn wrote:
>
> Hi Jon,
>
> On Tuesday 12 March 2002 11:54 am, Jon Molin wrote:
> > Gary Stainburn wrote:
> > > Hi all,
> > >
> > > I've got a project where I need to develop an single-board-computer based
> > > network devi
83 matches
Mail list logo