I think you have most of this solved. You even already have the numbers in
a variable, ready to use. In the following line,
if (/(\d{1})(\,)(\d{3})/) {
the part of the string that is represented by each set of parentheses within
the match is assigned a numeric variable ($1, $2, etc.).
So t
Hi
I am want to add digits in In_digits together.
Print total to screen.
Could someone help?
Thanx
Bruce
In_digits:
1,200
2,400
#!/usr/bin/perl -w
open(INPUT, "In_digits") || die;
open(OUTPUT, ">Out_digits") || die;
while () {
if (/(\d{1})(\,)(\d{3})/) {
print OUT
Daniel,
Thanks for the suggestion, but I'd already tried that variation-on-a-theme
with no luck.
I'm really looking for the right code to have telnet execute an Enter key
function at the finish of my perl script.
John--
-Original Message-
From: Daniel Gardner [mailto:[EMAIL PROTECTED]]
Hi
I am want to add digits in In_digits together.
Print total to screen.
Could someone help?
Thanx
Bruce
In_digits:
1,200
2,400
#!/usr/bin/perl -w
open(INPUT, "In_digits") || die;
open(OUTPUT, ">Out_digits") || die;
while () {
if (/(\d{1})(\,)(\d{3})/) {
print OUT
most providers such as Sprint PCS has a web interface/cgi script that
allows a visitor to send a text message to a sprint phone.
On Mon, 11 Mar 2002, Joyce Harris wrote:
> I am looking for info on how to send an alert message to a cell phone
> from a perl script. Any ideas?
>
>
> --
> To
Hello John,
Monday, March 18, 2002, 5:15:18 AM, John wrote:
> I do not understand the results of the following experiment, and would
> appreciate input.
> Using telnet on a Win PC, I executed this code:
> perl -e print "Hello world.\n\r"' > /dev/tty1
> On my Linux system monitor (/d
I do not understand the results of the following experiment, and would
appreciate input.
Using telnet on a Win PC, I executed this code:
perl -e print "Hello world.\n\r"' > /dev/tty1
On my Linux system monitor (/dev/tty1), I see "Hello world." printed along
with the newline and carria
works for me, so nothing wrong with your perl code.
maybe you could show us the url you are using to reach this code.
On Saturday, March 16, 2002, at 10:34 PM, Mariusz wrote:
> html tags are not the problem. I included another print statement before
> the loop and that outputs "text 1 here" to
Swansong wrote:
>
> I'm fairly certain I'm attacking this incorrectly, so any advice is
> greatly appreciated...
>
> Task:
>
> I want to sort through my Solaris syslog (/var/adm/messages) looking for
> any system reboots which always start with the string SunOS and, if
> found, return that line
swansong [[EMAIL PROTECTED]] quoth:
*>I'm fairly certain I'm attacking this incorrectly, so any advice is
*>greatly appreciated...
Well...there are easier ways to do it. Let syslog do the work for you
and add
'kern.debug /var/adm/kern_debug.log'
to /etc/syslog.conf [ the space must be a tab
Here is a simplistci approach which does what you want:
while ( ) {
next if ( ! /SunOS/ );
printf "The desired line's number is $.\n";
print $_;
for ($i = 0; $i < 20; $i++) {
$_ = ;
print $_;
}
}
Tested gave the corrct line number, SunOs plus 20 more lines.
Wag
My apologies for the 3 posts, netscape kept crashing so my last one from IE
is the newest code...
my dilemna isn't that it starts at the beginning of the line, the regex, as
it doesn,'t.
rather, how do I say
open file, read file, for every occurrence of , print that line + the
next 20 lines imm
Sunday, March 17, 2002, 9:44:49 PM, swansong wrote:
> I'm fairly certain I'm attacking this incorrectly, so any advice is
> greatly appreciated...
> Task:
> I want to sort through my Solaris syslog (/var/adm/messages) looking for
> any system
> reboots which always start with the string SunOS a
I'm no expert myself, so I can't comment on the perl, but if as you say the
"SunOS" is at the start of the line.
> reboots which always start with the string SunOS and, if found, return
You may want to put a ^ in your regex to fix this. So,
> if ($_ =~ /SunOS/)
becomes:
if ($_ =
I'm fairly certain I'm attacking this incorrectly, so any advice is
greatly appreciated...
Task:
I want to sort through my Solaris syslog (/var/adm/messages) looking for
any system
reboots which always start with the string SunOS and, if found, return
that line and
the next 20 lines, at least fo
I guess you're not familiar with dancc scripting? :)
At the very least, if you must ask for help because you're stuck on
something, ask for help on the thing you're stuck on, don't just ask someone
to write it for you. People charge for that sort of thing.
-Original Message-
From: Jo
> I am trying to create a script that read a
> file and count consonnant then output the
> results to another file. I would ask here
> if anybody can help me to write the script.
Does this sound like homework or what?
> 1. the c at the end of words
> 2. the cc at the end of words
> 3. the cing
> Perhaps you learnt to program with something like
> Apple Basic like I did when I was
> 10 years old on the Apple IIe
> which requires line numbers.
Or the BBC Micro, or the commodore 64, or the
Spectrum or the .
> Perl doesn't need them.
But you can have them if you want them:
#!/usr/bin/pe
Whoa. That brings back memories. The scary thing is that two years ago I
was working at a place that still had their entire inventory/purchasing/HR
system was programmed in BASIC. They didn't seem to get it when I pointed
out that anyone could press ^C, GOTO the line were the passwords were
a
Perhaps you learnt to program with something like Apple Basic like I did
when I was 10 years old on the Apple IIe which requires line numbers. Perl doesn't need them.
gkotsovilis wrote:
> How do you keep line numbering straight in a perl script.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> How do you keep line numbering straight
> in a perl script.
No code example? I can only assume you want:
while (<>) {
printf "%.5d: %s", $., $_;
}
or maybe:
while (<>) {
printf "%5s: %s", $., $_;
}
or even:
perl -n -e 'printf"%.5d: %s",$.,$_'
Clear description of your requirement
From: gkotsovilis <[EMAIL PROTECTED]>
> How do you keep line numbering straight in a perl script.
Beg your pardon?
What line numbering? How is it not straight? What do you do, what
do you expect and what do you get?
Jenda
=== [EMAIL PROTECTED] == http://Jenda.Krynicky.cz ==
T
On Fri, 15 Mar 2002 16:03:03 -0500, [EMAIL PROTECTED] (Peter Farrar)
wrote:
>
>I've been growing interested in the Tk module too. I found this today.
>It's really really introductory.
>
>http://www.perl.com/pub/a/1999/10/perltk/
>
>
>I am planning to write a litte graphical interface for an appli
How do you keep line numbering straight in a perl script.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Sunday, March 17, 2002, 1:10:16 PM, Zysman, Roiy wrote:
> I'm sorry if i wasn't clear
> after tmp_ can come any character for example tmp_6676frf877 or
> tmp_hbhbbd3y78783xcbh
> how can i limit my regex to catch any character but not "/"
> Thx Roiy
how about
m|/(tmp_[^/]+)|;
which says, "mat
I'm sorry if i wasn't clear
after tmp_ can come any character for example tmp_6676frf877 or
tmp_hbhbbd3y78783xcbh
how can i limit my regex to catch any character but not "/"
Thx Roiy
-Original Message-
From: Mark Maunder [mailto:[EMAIL PROTECTED]]
Sent: Sunday, March 17, 2002 12:13 PM
To:
Also, check out PerlMagick - a perl interface into the ImageMagick library of
image manipulation. The homepage is at:
http://www.imagemagick.org/www/perl.html
You can resize images to create thumbnails, and insert text into images (like your
site's URL for example) and do a bunch of other cool st
> Thanks. I got lots to learn about perl, thinking
> for the 2 hours I was trying to solve my issue
> with chomp and split. I have began disecting your
> reponse to learn from it. One question, the last
> print statement:
>
> print $_ . "\n";
since ($Jonathan eq "Fool") {
Opps... I've abondone
Sunday, March 17, 2002, 12:43:07 AM, [EMAIL PROTECTED] wrote:
> I'm writing a CGI program that requires that I discover the dimensions of an
> image that a person uploads. Can perl or javascript do that?
The Image::Size module on CPAN does exactly that:
http://search.cpan.org/search?dist=Image
Sunday, March 17, 2002, 10:41:01 AM, Mark Maunder wrote:
> You have two dollar signs before the 'name' variable in
> the loop. That probably works provided the value of the
> variable is not a number, but it may be causing the
> strangeness you're experiencing. Always 'use strict' in
> your scrip
Hi everyone,
I'm writing a CGI program that requires that I discover the dimensions of an
image that a person uploads. Can perl or javascript do that?
Thanks
Tricia
Sunday, March 17, 2002, 12:18:01 AM, Dave Chappell wrote:
> Thanks. I got lots to learn about perl, thinking for the 2 hours I was
> trying to solve my issue with chomp and split. I have began disecting your
> reponse to learn from it. One question, the last print statement:
> print $_ . "\n";
You have two dollar signs before the 'name' variable in the loop. That probably works
provided the value of the variable is not a number, but it may be causing the
strangeness you're experiencing. Always 'use strict' in your scripts. You should be
storing your params in a hash and doing somethi
What are you trying to match? If it's just the dir name then:
/\/(tmp_\w)/ will do it and set $1 to equal your directory name.
~mark.
http://www.workzoo.com/
"Zysman, Roiy" wrote:
> Hi All,
> As we all know Regular Expressions are very greedy and tries to big as big
> as possible.
> How do i l
> print CGI::header();
> print "hello\n";
> print "foo\n";
> print "bar\n";
> foreach my $line () {
> my $result = &do_something($line);
> }
> use LWP::Simple;
> my $credit_card_server = "secure.mybank.com";
> my $username = "my_secret_username";
> my $password = "my_pass
35 matches
Mail list logo