"Scott R. Godin" wrote:
>
> try this for starters (tested)
>
> #!/usr/bin/perl
> require 5.006;
> use warnings;
> use strict;
>
> my $usrname = $ARGV[0] || 'daneilson';
>
> open(PASSWD, '<', '/etc/passwd')
> or die "Unable to open /etc/passwd: $!";
>
> #dunno how big it is so let's line-b
I've to Thank Charles once again for the latest post which solved the
puzzle.
Jeff gave the solution as s/ ( +)/' ' x length($1)/g;
which is what I want but did not work as intended because of the missing e
at the end of the expression
but after looking at Charles example s/(\s\s+)/' ' x (length(
On Nov 28, Leon said:
>> s/ ( +)/' ' x length($1)/g;
I'm sorry, I left out the /e modifier.
s///eg;
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
** Look for "Regular Expressions i
- Original Message -
From: "Jeff 'japhy' Pinyan" <[EMAIL PROTECTED]>
To: "Leon" <[EMAIL PROTECTED]>
> >(Q2)How to do the following :-
> > If there are 2 spaces, I wish to convert it into 1 like
> >this =>
> > 3 spaces into 2 like this =>
> > 4 spa
On Wed, 28 Nov 2001, Daniel Falkenberg <[EMAIL PROTECTED]> wrote,
> Hey all,
>
> [Config File]
> Linux Passwd File = /etc/passwd
> New File = /home/test
> Old File= /home/test
> Company Name = Company Name
> Compan
Hey all,
My sincerest apologize to all! The last post has does exactly what I
want it to do. There is no need have to do anything else at all with
the code. Trial and error :)
Regards,
Dan
Hey all,
[Config File]
Linux Passwd File = /etc/passwd
New File
Hey all,
[Config File]
Linux Passwd File = /etc/passwd
New File= /home/test
Old File = /home/test
Company Name = Company Name
Company URL = http://www.servername.com
Above is a config file I j
Hi
I am trying to display the details filled in the feedback form.
I want to display it below the feedback form.
The comments entered by the client should be displayed below the feedback
form after the submit button is clicked.
what will be the code for the same in Perl
Thanks in advance
-
On Nov 28, Leon said:
>(Q1)How to put these three substitutions into one single substitution
>regex.
>$a =~s/$a =~s/>/gt/;
>$a =~s/\\n//;
You should have the /g modifier on those regexes. But here's how to mash
them into one:
my %translate = qw( < lt > gt \n );
my $pat = join '|', m
I have 2 things which I need members help.
(Q1)How to put these three substitutions into one single substitution
regex.
$a =~s//gt/;
$a =~s/\\n//;
(Q2)How to do the following :-
If there are 2 spaces, I wish to convert it into 1 like
this =>
3 spaces into 2 lik
[EMAIL PROTECTED] writes:
> Hello, and thanks for your time
>
> I was wondering if perl can modify from a web page (Form) a
> .vacation message for user or modify ./forward files
If the file permissions allow it, yes. But that's probably a bad
idea. Generally the web server, and thus Perl CGI
Hi Daniel,
On Wed, Nov 28, 2001 at 11:13:59AM +1030, Daniel Falkenberg
([EMAIL PROTECTED]) said something similar to:
[snip]
> %users = (
>'crud' => '503',
>'test' => '45',
>'test4' => '45',
>'test2' => '45',
>'daniel'=> '45'
>
Hey all,
crud:x:503:503::/home/tunnel:/bin/bash
test:x:504:45:Test Account:/home/test:/bin/false
test4:x:506:45:test Account:/home/test4:/bin/false
test2:x:507:45:Test Account:/home/test2:/bin/false
daniel:x:508:45:Crudles:/home/daniel:/bin/false
The followowing hash is created below with the fo
Hello, and thanks for your time
I was wondering if perl can modify from a web page (Form) a
..vacation message for user or modify ./forward files
Or to just create autoresponders
my raq 3 has vacation messaging, but it's not that useful
unix systems have had autoresponders for years
I thought ma
On Tue, 2001-11-27 at 22:34, Scott R. Godin wrote:
> I've noticed that near 99% of the spam I receive uses this method to
> mask it from reciept, so typically I filter this with my mailer into a
> dumping ground, but the sheer amount of spam lately (235 items since Nov
> 5th) has caused me to f
Although Perl is a great tool for this sort of thing, there are others
as well, most notably Procmail. And there's an excellent filter
system called the Spam Bouncer which consists of a bunch of procmail
scripts which does just what you want. See http://www.spambouncer.org/
for more info.
--Bi
On Tue, 2001-11-27 at 22:22, Pete Emerson wrote:
> So for example, if I have
> Strongly Agree
I'd use HTML::TokeParser, because it's lovely.
Assuming you initialise a new TokeParser object to $p, try:
my %option_choice;
# for each , if there's a 'name=' token, initialise a hash of:
# the name
At 05:34 PM 11/27/2001 -0500, Scott R. Godin wrote (to a *lot* of lists):
>I'm very anxious to get back at these spamming bastards somehow, as this
>intrusion into my personal e-mail is MOST unwelcome, and I've got a
>growing passion to stamp out this *expletive deleted* practice as often
>as I ca
On Tue, Nov 27, 2001 at 05:34:08PM -0500, Scott R. Godin wrote:
> Can you kind folks offer some pointers to me as to how I can go about
> such a task, and what would be some of the traps and pitfalls to avoid
> (of which I'm quite sure there are many) in the process?
I'd start with Mail::Audit
has anyone implemented a 'better version' of the vacation program for
themselves?
I'm particularly interested in 'screening' the bulk-mail type messages
that list me in their "bcc:" header so that my address does not show up
in the "from:" or "cc:" address listings, thus preventing
/usr/bin/
I use Text-PDF-API-0.701.1 on Win32 and it works well. The original tar file
on CPAN has lots of examples
HTH
Clinton
- Original Message -
From: "paul beckett (JIC)" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 27, 2001 2:01 AM
Subject: Outputing data for Excel / PDF
I am parsing an HTML page which has forms on it.
I think maybe this belongs here instead of cgi-beginners?
(Note, I'm parsing the form source, not the form results!)
I am trying to extract the variable names as well as their
labels so that I can write out an SPSS file which maps
variable names t
>"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 d
I am accepting some input values via a web form. I want to compare their
values to values in the database and then update those that are different.
I am using hashes to hold the values. Here's what we've got:
#values sucked in from a form:
$params = {
report_1 => 'yes',
report
> -Original Message-
> From: Mcgregory Pinto [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 3:02 PM
> To: [EMAIL PROTECTED]
> Subject: Reading Environment Variables
>
>
> Hi all ...
>
> I´m working in a Unix environment, and I´ve two shell scripts
> xxx.sh and
> zzz.sh.
Here is one shot at it:
#!perl -w
my %Quantities = ();
while ( ) {
my ($partnum,$qty) = split(/_/, $_);
if ( ! defined $Quantities{$partnum} ) {
$Quantities{$partnum} = 0;
}
$Quantities{$partnum}+=$qty;
}
foreach (sort keys %Quantities ) {
printf "%-6s: %6d\n", $_, $Qua
On Tue, Nov 27, 2001 at 06:02:12PM -0200, Mcgregory Pinto wrote:
> my $grg = $ENV{GRG};
> print "$grg\n"; // must print 'aaa'
> system("xxx.sh")
> my $grg = $ENV{GRG};
> print "$grg\n"; // must print 'xxx'
> system("zzz.sh")
> my $grg = $ENV{GRG};
> print "$grg\n"; // must print 'zzz'
I'm having trouble trying to add some values. I have a data file that
consists of part numbers and quantities. I open that file, load the
data file into an array. My problem is that my data file has been
created by a process I cannot control, so that many times the
data file will show the same
Hi all ...
I´m working in a Unix environment, and I´ve two shell scripts xxx.sh and
zzz.sh.
This scripts change the value of environment variable GRG initialized with
'aaa'. The first fill with 'xxx' the second fill with 'zzz'.
I need to call this scripts in a Perl script and get the variable GRG
"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
Hello, I am interested in purchasing a script to use
on a membership site. I will need to integrate
it with an offsite credit card co.
i.e payPal, IBill.
I am looking for recommendations good or bad.
I have tried Account Manager, Profile Manager,
and a few others.
Thanks for your response.
-
Michael,
I didn't say that Perl was slower. I didn't know the difference between the
overhead of the Perl interprter for a built-in function and calling a shell
command from the Perl code because in both cases Perl commands were to be
executed and interprted. My concern was the portability which
On Tue, Nov 27, 2001 at 04:18:15AM -0800, Ahmed Moustafa Ibrahim Ahmed wrote:
> Performance wise, both are almost the same, I think. But using the Perl
> built-in functions would help make your code more portable.
Given that a shell script has to fork and exec a seperate process for almost
every
On Tue, Nov 27, 2001 at 02:38:42PM +1030, Daniel Falkenberg wrote:
> Now with the following I want to be able to only find the user name that
> has a GID of 45 and make sure the username exists in /etc/passd in the
> first place.
Instead of parsing /etc/passwd directly you should probably be usin
On Tue, Nov 27, 2001 at 12:31:02PM +0100, Andrea Holstein wrote:
> for ($PASS{$PASSWD_NAME}) {
> $new_user = $_{user};
> $new_pass = $_{password};
> $new_fname = $_{fname};
> $new_lname = $_{lname};
> }
In that snippet you're accessing the hash %_, when you should be acces
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Purshottam Chandak) wrote:
> Is there a major difference between the Perl at Perl.com and Active Perl?
>
> Pc
ActiveState's Perl has been set up with Windows in mind. If you need to
run Perl on a Win32 platform, then ActiveState's your place
From: Frank Newland <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject:substr and =~ as one liner
Date sent: Tue, 27 Nov 2001 11:55:32 -0600
> How can I express the following two lines as a one liner?
> ===
> $l
How can I express the following two lines as a one liner?
===
$left_trim = substr($_,85,13);
$left_trim =~ s/^\s+// ; ## Remove leading spaces
===
tia
frank
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
I'm still a real beginner and think Mail::Sender is about as easy as it
gets...
Since the subject has been brought up, pls take a look at my simple sub for
emailing files. I know this code works but can be improved. I send the
file name(s) to be attached, a file name for the message text, and
I'd like some help running single line programs from the command line with
the -e parameter. I keep having problems.
Thanks.
Pc
_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail:
On Tue, 27 Nov 2001, Jorge Goncalvez <[EMAIL PROTECTED]> wrote,
> Hi I have this:
>
> my $ip="192.40.54.41";
>
> $ip=~ s/(\d+\.\d+)\.(\d+\.\d+)/$1\.0/;
>
> print $ip;
>
> But It didn't work it displays 192.40.0 and I wanted to display 192.40.54.0.
> Why? thanks.
The first parentheses (refere
> -Original Message-
> From: Jorge Goncalvez [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 10:31 AM
> To: [EMAIL PROTECTED]
> Subject: RE:help on Regex
>
>
> Hi I have this:
>
> my $ip="192.40.54.41";
>
> $ip=~ s/(\d+\.\d+)\.(\d+\.\d+)/$1\.0/;
^^^
Or, just use MIME::Lite or another module which does these things for you :)
Cheers,
Kevin
On Tue, Nov 27, 2001 at 09:20:35AM -0600, Tomasi, Chuck ([EMAIL PROTECTED]) said
something similar to:
> Here's one I can answer! I agonized over this for weeks, but finally got a
> decent solution that
Hi I have this:
my $ip="192.40.54.41";
$ip=~ s/(\d+\.\d+)\.(\d+\.\d+)/$1\.0/;
print $ip;
But It didn't work it displays 192.40.0 and I wanted to display 192.40.54.0.
Why? thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Is there a major difference between the Perl at Perl.com and Active Perl?
Pc
_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [E
--oops! sorry.
--the example i MEANT to send was this:
[example:]
open (INFILE, ">infile") || die("die trying: $!");
print INFILE `/usr/bin/psql -U web -f /home/make.test database`;
if ($web) { open MAIL, ">-"; }
else {
open MAIL, "|/usr/lib/sendmail" || print "nope, can not send mail\n";
$a
> You can try the following
>
> ($percent) = `df -k` =~ /(\d+)%/;
>
> Regards
> Robert Graham
There you go James !!
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Here's one I can answer! I agonized over this for weeks, but finally got a
decent solution that I use every day!
For a binary file I would recommend "use MIME:Base64". An example is
provided.
Notes:
o You'll want to use multi-part MIME encoding (hence the use of
MIME::Base64). You cou
--yes.
--at least that's what i do when i send a basic
text file to remind me of something that i've done.
[example:]
addr='[EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]'
mailcmd=/usr/sbin/sendmail
(some work going on here)
$mailcmd $addr < /tmp/reminder.txt
[/example]
--but the b
> -Original Message-
> From: Paul Jasa [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 10:09 AM
> To: 'Bob Showalter'; [EMAIL PROTECTED]
> Subject: RE: Send e-mail attachment
>
>
> Good question. I think that is done so that you can write
> other things to
> the LETTER pr
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Kevin Zembower) wrote:
> I have a program that requires Mail::Mailer.pm. When I try to run it, I
> get:
> www:/usr/local/httpd/cgi-bin # ./mail2friend.pl
> Can't locate Mail/Mailer.pm in @INC (@INC contains:
> /usr/lib/perl5/5.6.0/i586-linux /u
Good question. I think that is done so that you can write other things to
the LETTER prior to mailing it?
Paul
-Original Message-
From: Bob Showalter [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 8:02 AM
To: Paul Jasa; [EMAIL PROTECTED]
Subject: RE: Send e-mail attachmen
> -Original Message-
> From: Paul Jasa [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, November 27, 2001 9:53 AM
> To: 'paul beckett (JIC)'; [EMAIL PROTECTED]
> Subject: RE: Send e-mail attachment
>
>
> Paul,
> one of my favorite lines in my scripts is:
>
> open LETTER, "|mailx -s "SUBject
Paul,
one of my favorite lines in my scripts is:
open LETTER, "|mailx -s "SUBject Here!!" someone\@somewhere.com <
/some/file";
open LETTER, "|mail -s "SUBject Here!!" someone\@somewhere.com <
/some/file";
This sends an email with an whatever is in /some/file in the body. I don't
know if this
Check CPAN for:
Test::Unit
Test::Simple
Test::More
and a few others.
Dave
On Mon, 26 Nov 2001, Ahmed Moustafa Ibrahim Ahmed wrote:
> Hi Everybody,
>
> How can I automate the process of testing my Perl script?
> Is there a standard way to do?
> Is there a tool for testing Perl scripts?
>
> Yo
You can try the following
($percent) = `df -k` =~ /(\d+)%/;
Regards
Robert Graham
-Original Message-
From: Kipp, James [mailto:[EMAIL PROTECTED]]
Sent: 27 November 2001 15:47
To: 'James Kelty'; [EMAIL PROTECTED]
Subject: RE: File System Sizes
>
> $percent = `df -k | awk '{print $
>
> $percent = `df -k | awk '{print $5}'`;
> if($percent > "90") {
>
> do something
> }
>
> I though that this would work, but I didn't get just the %
> column from the
> awk statment. I am really trying
> to do this all in perl instead of mixing it with awk.
in that case all
Well my english isn't good enough
I meant the oldest meaning there was only ONE oldest so it's 2,2,9
Because it was too easy if there were 2 oldests.. only combinaison would
be 1,6,6
Anyways, it was pure logic.. find all possibilities of 3 ages that gives
36.
keep the two with the same total (1
Performance wise, both are almost the same, I think. But using the Perl
built-in functions would help make your code more portable.
--Ahmed
Nafiseh Saberi wrote:
> hi all.
>
> we can write shell script in perl source.
> but which of them is better ??
> e.g:
> for build directory..
> we can w
From: Andrea Holstein <[EMAIL PROTECTED]>
> [EMAIL PROTECTED] wrote:
> >
> > Here is a basic question on %ENV hash. I gave a pronto statement as thus:
> >
> > perl -e "print $ENV{ComputerName};"
> >
> > and it printed the correct information.
> >
> > On my MS-DOS prompt when I gave the SET com
From: "paul beckett (JIC)" <[EMAIL PROTECTED]>
> Does anybody know how I can send a smallish binary file as an e-mail
> attachment, from perl (running on UNIX (OSFv.4.0))
Either MIME-lite or Mail::Sender. Both available from CPAN
Jenda
=== [EMAIL PROTECTED] == http://J
From: "Quelance" <[EMAIL PROTECTED]>
> replace any matched spaces with
> replace a new line with
>
>
> while() {
> s/\s/ /; #replace spaces with
> s/\n/\n/; #replace newlines with
> print $_;
> print
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] (Daniel Falkenberg) wrote:
> Hey all,
>
> I have a problem here that I don't really know how to go about.
>
> Basically I want to be able to find a user in the /etc/passwd with only
> a GID of 45 and a username of what I type the user name to
Hello, I am interested in purchasing a script to use
on a membership site. I will need to integrate
it with an offsite credit card co.
i.e payPal, IBill.
I am looking for recommendations good or bad.
I have tried Account Manager, Profile Manager,
and a few others.
Thanks for your response.
Hi,
Please check www.activestate.com, they have a windows Perl Port which has
OLE support.
N.Dinesh
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Does anybody know how I can send a smallish binary file as an e-mail
attachment, from perl (running on UNIX (OSFv.4.0))
Thanks
Paul
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
You Can use defined() perl function
--
From: John W. Krahn [SMTP:[EMAIL PROTECTED]]
Sent: Tuesday, November 27, 2001 3:37 PM
To: [EMAIL PROTECTED]
Subject: Re: Checking to see if $user exists in a hash.
Daniel Falkenberg wrote:
Hi Martin!
I don't understand the warning, too.
But there are some little things, which could, but needn't be a problem
Martin Pfeffer wrote:
> use DBI;
> my $dir = "/Webserver/www.xxx.at/martin/cgi-bin/test/";
> my $dbh = DBI -> connect("DBI:CSV:") || die "$1 --- $DBI::errstr";
Jorge Goncalvez wrote:
>
> Hi, I have this:
> print NOUVEAU $newline2\n or die "je ne peux écrire dans $nouveau : $!\n";
>
> But it prints but didn't go to the next line(\n seems to be ignored)
> Why?
The newline needs to be in quotes to be interpolated
print NOUVEAU "$newline2\n" or die "je
Daniel Falkenberg wrote:
>
> I have just created the hash that looks like this
>
> %users = (
>'uucp' => '14',
>'daemon' => '2',
>'daniel' => '45',
>'test2' => '45',
>'halt' => '0',
>'test4' => '45'
> );
>
> $u
Hi, I have this:
print NOUVEAU $newline2\n or die "je ne peux écrire dans $nouveau : $!\n";
But it prints but didn't go to the next line(\n seems to be ignored)
Why?
Thanks.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
hi all.
we can write shell script in perl source.
but which of them is better ??
e.g:
for build directory..
we can write perl code and use shell script.
which of them is better ??
in speed ?? or any condition?
thx
Nafiseh Saberi
__
Hi all
I write the following code and he works fine :
use DBI;
my $dir = "/Webserver/www.xxx.at/martin/cgi-bin/test/";
my $dbh = DBI -> connect("DBI:CSV:") || die "$1 --- $DBI::errstr";
$dbh->do("CREATE TABLE testtablex (id INTEGER, name CHAR(64))");
my $sql = qq(insert into testtable values
- try this
#!/usr/bin/perl -w
$user = "daneilson";
$file = '/etc/passwd';
open PASSSWD, "$file" or die "Cannot open $file for reading :$!";
@lines = ;
foreach $record (@lines) {
@record = split /:/, $record;
if ($record[3] ==45) {
## d
74 matches
Mail list logo