Hi Everybody,
I have a script where I need to replace 45 in the beginning, with nothing in a
variable
It looks like this:
#!/usr/bin/perl
$modtager = 45247;
$modtager =~s/45//;
Then $modtager is 247, but if forinstance the number is 4545247, it should
return 45247, how do I do this ?
On Fri, Dec 02, 2005 at 10:22:47AM +, Mads N. Vestergaard wrote:
I have a script where I need to replace 45 in the beginning, with nothing
in a variable
It looks like this:
#!/usr/bin/perl
$modtager = 45247;
$modtager =~s/45//;
Then $modtager is 247, but if forinstance
On Fri, Dec 02, 2005 at 10:22:47AM +, Mads N. Vestergaard wrote:
I have a script where I need to replace 45 in the beginning, with nothing
in a variable
It looks like this:
#!/usr/bin/perl
$modtager = 45247;
$modtager =~s/45//;
Then $modtager is 247, but if forinstance the
I tried using the File ::copy and then the move command it says permission
denied
Just a brief of what is hapening
i have a file with text like this
aaa.bbb e:\cme\abc.vws
i am splitting this data based on space and want to move the data in
e:\cme\abc.vws to e:\cme1\.
I am able to
Sorry for that Hridyesh. I apologize.
I registered with my gmail account to this mailing group and tried sending the
mail thru my official account. The mail didn't get posted for 3 hours i thought
just because i am not registered thru this email id thts why its not popped up.
So i sent mail
unless you use this syntax :
$modtager =~s/45//g;
only the first occurence of the searched string will be replace...
so what you wrote should work fine...
BR
Mads N. Vestergaard wrote:
Hi Everybody,
I have a script where I need to replace 45 in the beginning, with
nothing in a
What's the rationale for hardwiring the Perl executable pathname into
the Perl interpreter? It is some oddity to guarantee Perl can find its
library via a relative path? Is it a safety thing?
Adriano.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
On Fri, 2 Dec 2005, Adriano Ferreira wrote:
What's the rationale for hardwiring the Perl executable pathname into
the Perl interpreter? It is some oddity to guarantee Perl can find its
library via a relative path? Is it a safety thing?
Yeah, basically.
Historically, Unix users could depend
On 12/2/05, Chris Devers [EMAIL PROTECTED] wrote:
Historically, Unix users could depend on a copy of Perl in /usr/bin from
their vendor, and maybe a custom-installed one somewhere like /opt/bin
or /usr/local/bin. With that in mind, using one of those paths usually
would do something useful.
On Fri, 2 Dec 2005, Adriano Ferreira wrote:
I see your point, Chris. What I was thinking about was the trouble to
realocate the interpreter if you have a perl binary instead of
compiling it from the source. If you use a perl compiled to be in
/usr/local/bin in a different path like
Hi
Anyone know if theres an archive link for this mailing list.
Kind Regards
Brent Clark
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On 12/2/05, Chris Devers [EMAIL PROTECTED] wrote:
But anyway, yeah. In general, you can't depend on things working
consistently if you just start randomly moving around compiled programs
and libraries. Sometimes it won't matter, but other times, the results
just won't be predictable.
Ok. I
Brent Clark wrote:
Hi
Anyone know if theres an archive link for this mailing list.
Kind Regards
Brent Clark
What about http://groups.google.com/group/perl.beginners?lnk=sg ?
hth
E.
--
Elie De Brauwer
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
On 12/2/05, Brent Clark [EMAIL PROTECTED] wrote:
Anyone know if theres an archive link for this mailing list.
You can find The Perl Mailing List Database at
http://lists.perl.org
and from there
http://lists.cpan.org/showlist.cgi?name=beginners
where you will find the
On Fri, 2 Dec 2005, Brent Clark wrote:
Anyone know if theres an archive link for this mailing list.
Presumably :-)
Tried Google?
http://www.google.com/search?q=perl+beginners+mailing+list+archive
That refers, among other things, to the following FAQ entry:
1.4 - Is there an archive on
M. Lewis wrote:
I'm trying to move the configuration variables out of three perl scripts
and put them in a config file. Fine, no problem so far.
The way this works is an email message with a given subject is processed
by procmail then passed off to the first perl script. The first script
On 12/2/05, Chris Devers [EMAIL PROTECTED] wrote:
My understanding is that the Python idiom is to avoid putting the full
path, in favor of something like
#!/usr/bin/env python
#!env python
on grounds that Python may not be quite as common, but you could depend
on the `env` command
I want to know how many new line chars there are in all files in a
directory (and it's subdirectories). What's the best way?
Thanks!
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
On Dec 2, The Ghost said:
I want to know how many new line chars there are in all files in a directory
(and it's subdirectories). What's the best way?
You'll want to use File::Find (a standard module) to do your directory
recursion for you. For each file you get to, open it, count its
On Fri, 2 Dec 2005, The Ghost wrote:
I want to know how many new line chars there are in all files in a
directory (and it's subdirectories). What's the best way?
I'm sure this isn't how you want to do it, but this might work:
$ cat `find . -type f` | wc -l
It'll choke if you have too
The Ghost mailto:[EMAIL PROTECTED] wrote:
: I want to know how many new line chars there are in all files
: in a directory (and it's subdirectories). What's the best way?
A lot depends on your idea of best. It might be that the
best way is to hand the project off to someone else and reap
Hi,lists,
I usually meet some problems of closure when do development under mod_perl.
Can anyone tell me that what use of a closure in perl?thanks.
The Ghost [EMAIL PROTECTED]asked:
I want to know how many new line chars there are in all files
in a directory (and it's subdirectories). What's the best way?
Use File::Find to iterate over the files and then sum up the
newlines you find in each file. Counting the newlines in a
single file is
#!/usr/local/bin/perl
#
# recurs.pl
#
# This script executes recursively on subdirs the command you supply as a
parameter
#
# Run program -h to see the run options
#
# Last modified: Apr 10 1997
# Author: Bekman Stas [EMAIL PROTECTED];
# [EMAIL PROTECTED];
$|=1;
On Dec 2, 2005, at 16:44, Jennifer Garner wrote:
Hi,lists,
I usually meet some problems of closure when do development under
mod_perl.
Can anyone tell me that what use of a closure in perl?thanks.
You mean under Apache::Registry?
-- fxn
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For
On 2 Dec 2005 at 23:44, Jennifer Garner wrote:
Hi,lists,
I usually meet some problems of closure when do development under
mod_perl. Can anyone tell me that what use of a closure in
perl?thanks.
Have a look at this doc. It is as full an explanation as your'll ever
get.
Jennifer Garner mailto:[EMAIL PROTECTED] wrote:
[snip]
: # Last modified: Apr 10 1997
[snip]
Please do not provide outdated, buggy solutions to a beginners
list. We are trying to do much more than just solve problems. We
are (hopefully) fostering good programming skills first and
Jennifer Garner wrote:
$|=1;
Be careful with this one. The documentation for it makes it sound like
it's a good idea to set this but doing so turns buffering OFF, not ON.
Normally you leave this alone, even for pipes and sockets; Perl does the
right thing in almost every case.
See:
I can see one problem off the top of my head. You aren't using chomp() on the
line, so $view_path probably has something like e:\\cme\\abc.vws\n in it.
-Original Message-
From: Manoj Thakkar, Noida [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 01, 2005 10:17 PM
To:
So far I did this:
#!/usr/bin/perl
use File::Find;
my $totalLines;
find(\wanted, '@directories');
sub wanted {
unless ($_=~m/.html|.mas|.pl|.txt$/i) {return 0;} #filter the kinds
of files you want
open FILE, $File::Find::name;
print $_: ;
my @lines=FILE;
Shawn Corey:
M. Lewis:
do './mcr.conf';
The only way I have found thus far to make this work [...]
is to change the above line to:
do '/absolute/path/to/mcr.conf';
Your problem could be one of two things.
1. The procmail is run by the user but not from the directory where
mcr.conf
Hi list.
I have two dates in format -MM-DD for example ( 2005-09-01), but I need to
pass them to timestamp format, how do I do it ???.
I tried with time, localtime, gmtime, but I can´t.
Thanks.
--
___
Get your free email from
Personally I like Time::Local for this kind of calculation, but there are some
Date:: modules out there that can do it too.
-Original Message-
From: Rafael Morales [mailto:[EMAIL PROTECTED]
Sent: Friday, December 02, 2005 11:23 AM
To: beginners@perl.org
Subject: Convert date to
I can`t find the way for do it with Time::Local, could you explain me please :)
- Original Message -
From: Timothy Johnson [EMAIL PROTECTED]
To: Rafael Morales [EMAIL PROTECTED], beginners@perl.org
Subject: RE: Convert date to timestamp
Date: Fri, 2 Dec 2005 11:39:23 -0800
Here's an example:
##
use strict;
use warnings;
use Time::Local;
my $textTime = 2005-09-01;
my ($year,$month,$day) = split(/-/,$textTime);
my $perlTime = timelocal(00,00,00,$day,$month,$year);
print Time: $textTime\n;
print Perl Time:
Correction: That line should be:
my $perlTime = timelocal(01,01,01,$day,$month - 1,$year);
^^
-Original Message-
From: Timothy Johnson
Sent: Friday, December 02, 2005 12:10 PM
To: 'Rafael Morales'; beginners@perl.org
Subject: RE:
Timothy Johnson wrote:
Correction: That line should be:
my $perlTime = timelocal(01,01,01,$day,$month - 1,$year);
You should use noon, not midnight (or close to it).
my $unix_epoch = timelocal( 0, 0, 12, $day, $month - 1, $year - 1900 );
Here in North America (at least in most places)
Hi all,
I don't know if the question that I am going the ask fits the beginner level,
but I am certainly a beginner in perl.
Is it possible for a module to refer to its calling script? For example, if I
create a module called MyModule.pm, and use it in a script MyScript.pl by saying
use
The Ghost wrote:
So far I did this:
#!/usr/bin/perl
use File::Find;
my $totalLines;
find(\wanted, '@directories');
sub wanted {
unless ($_=~m/.html|.mas|.pl|.txt$/i) {return 0;} #filter the
kinds of files you want
open FILE, $File::Find::name;
print $_: ;
my
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:
: Is it possible for a module to refer to its calling script?
I'm not sure what you mean by refer to, but you can
find the caller's name with the perl caller function. You
can find a practical example of its use here.
Dr.Ruud wrote:
If the .conf is in the same directory as the .pl, then $0 can help, see
`perldoc perlvar` and File::Basename, or maybe even `perldoc FindBin`.
True. But since the OP said 'mail' I assumed that meant more than one
user, each with a different configuration.
--
Just my
On Dec 2, 2005, at 21:52, [EMAIL PROTECTED] wrote:
Hi all,
I don't know if the question that I am going the ask fits the
beginner level,
but I am certainly a beginner in perl.
Is it possible for a module to refer to its calling script? For
example, if I
create a module called
[EMAIL PROTECTED] wrote:
Is it possible for a module to refer to its calling script? For example, if I
create a module called MyModule.pm, and use it in a script MyScript.pl by saying
use MyModule;, is it possible to refer to the calling script (MyScript.pl in
this case) and get some information
Thanks, to Timothy and Shawn four your help and time.
--
___
Get your free email from http://mymail.bsdmail.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
local(*in);
Does this indicate that you want to make all variables that begin with
$in private?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response
You're creating a typeglob *in and declaring it to be local. I'm not
sure why you would want to do this, but this makes $in, @in, and %in all
local.
-Original Message-
From: Buehler, Bob [mailto:[EMAIL PROTECTED]
Sent: Friday, December 02, 2005 3:13 PM
To: beginners@perl.org
Subject:
Buehler, Bob wrote:
local(*in);
Does this indicate that you want to make all variables that begin with
$in private?
No.
Perl has two kinds of scoping: lexical and dynamic. Lexical scoping
means the name only has meaning with the block, or if outside any block,
within the file. Dynamic
Shawn Corey wrote:
M. Lewis wrote:
I'm trying to move the configuration variables out of three perl
scripts and put them in a config file. Fine, no problem so far.
The way this works is an email message with a given subject is
processed by procmail then passed off to the first perl script.
Dr.Ruud wrote:
Shawn Corey:
M. Lewis:
do './mcr.conf';
The only way I have found thus far to make this work [...]
is to change the above line to:
do '/absolute/path/to/mcr.conf';
Your problem could be one of two things.
1. The procmail is run by the user but not from the directory
Thanks.Now I'm skilled to handled closure problems when developing under
mod_perl environment,including Apache::Register,Apache::DBI,and something
ohters.The thing I want to know is that if a closure is useful or not in
common perl program?
On 12/3/05, Dermot Paikkos [EMAIL PROTECTED] wrote:
On
Jennifer Garner wrote:
Thanks.Now I'm skilled to handled closure problems when developing under
mod_perl environment,including Apache::Register,Apache::DBI,and something
ohters.The thing I want to know is that if a closure is useful or not in
common perl program?
perldoc -q closure
John
--
The Ghost wrote:
So far I did this:
#!/usr/bin/perl
That should be followed by these two lines:
use warnings;
use strict;
use File::Find;
my $totalLines;
find(\wanted, '@directories');
Do you actually have a directory in the current directory named '@directories'?
sub wanted
Adriano Ferreira wrote:
On 12/2/05, Chris Devers [EMAIL PROTECTED] wrote:
My understanding is that the Python idiom is to avoid putting the full
path, in favor of something like
#!/usr/bin/env python
#!env python
on grounds that Python may not be quite as common, but you could depend
on
I recently started messing with perl sockets and I was wondering if it is
possible to do any of the following:
- Pre-shared key, to act as some sort of authentication. Currently I have
it checking the peer address, but I figure that could be spoofed.
- Stream large amounts of data, IE tar to
Hi all,
I have problem in perl script when executing external bash script using
backtick.
pscript.pl:
my $resultt = execute();
print RES: $result\n;
sub execute() {
my $ret = `/tmp/ping_yahoo.sh`;
return $ret || ;
}
When run using cmmondline, it works (gives the correct output),
Beast wrote:
Hi all,
Hello,
I have problem in perl script when executing external bash script using
backtick.
pscript.pl:
my $resultt = execute();
print RES: $result\n;
sub execute() {
my $ret = `/tmp/ping_yahoo.sh`;
You do realise that putting executable scripts in /tmp
John W. Krahn wrote:
You do realise that putting executable scripts in /tmp is a huge security risk?
Yes, the actual script is on different location, this is just for
testing only.
return $ret || ;
}
When run using cmmondline, it works (gives the correct output), but when
scheduled
57 matches
Mail list logo