Re: help with subroutines and reading/writing to file

2008-12-02 Thread Jim Hill
blake in <[EMAIL PROTECTED]>: > I am new to perl and attempting to write a script that will do a reverse dns > lookup on an ip [snip] Just looking that far, I don't think your script will work as you intend. Here's a ptr lookup using dig ... | dig -x 217.151.101.100 | 100.101.151.217.in-addr.ar

Re: help with subroutines and reading/writing to file

2008-12-01 Thread Telemachus
On Mon Dec 01 2008 @ 7:13, blake askew wrote: > Thanks for the help John. I have made the changes you suggested and managed > to get everything working properly. One more question though that is > completely different, how do I allow users to specify switches on the > command line in any order to

Re: help with subroutines and reading/writing to file

2008-12-01 Thread blake askew
Thanks for the help John. I have made the changes you suggested and managed to get everything working properly. One more question though that is completely different, how do I allow users to specify switches on the command line in any order to be used in my program. For example, I want the syntax t

Re: help with subroutines and reading/writing to file

2008-11-30 Thread John W. Krahn
blake askew wrote: I am new to perl and attempting to write a script that will do a reverse dns lookup on an ip, store this result into a file, then read the file in order to do a whois lookup. The whois lookup answer should also be written to a seperate file. I have the reverse dns lookup workin

help with subroutines and reading/writing to file

2008-11-30 Thread blake askew
I am new to perl and attempting to write a script that will do a reverse dns lookup on an ip, store this result into a file, then read the file in order to do a whois lookup. The whois lookup answer should also be written to a seperate file. I have the reverse dns lookup working, but when I also ca

Re: writing to file

2007-06-23 Thread Yogesh Sawant
Vahid wrote: > Hi all, > I have the following code to sort UNIX's password file, it works fine > but can only display on stdout. How can I make it write the output to > a file? > Thanks, > > #!/bin/perl -w > # > use strict; > open(myFILE, '|-','awk','-F:','s[$1]++==0' ) or die $!; > open(passwdFH,

writing to file

2007-06-21 Thread Vahid
Hi all, I have the following code to sort UNIX's password file, it works fine but can only display on stdout. How can I make it write the output to a file? Thanks, #!/bin/perl -w # use strict; open(myFILE, '|-','awk','-F:','s[$1]++==0' ) or die $!; open(passwdFH, "passwd"); while () { print myFILE

Re: trouble with writing to file

2004-03-03 Thread Jan Eden
incognito wrote: >Thank you for your attention, Bob. > >>What is your actual regex? At a minimum, you'll need /g modifier. >>You may need /m and/or /s as well. > >May be I didn't explained my prob exactly. I don't have a problem >with the regex (and yes, I have the /m /g and /s). Related to the >

Re: trouble with writing to file

2004-03-01 Thread david
Wc -Sx- Jones wrote: [snip] > > my $file = "20040301-www.tgz"; > [snip] > > But I have a question - > > Does even mentioning (?:) usage break capturing? > > I get undefined errors when trying: > > $file =~ /^(\d+)-www.t(?:ar.)gz/i; > print $1; no. it won't break capturing. you get undef

Re: trouble with writing to file

2004-03-01 Thread WC -Sx- Jones
Owen wrote: On Mon, 1 Mar 2004 18:08:08 +0100 incognito <[EMAIL PROTECTED]> wrote: open(FH, "> $pkg_filename") or die "could not create $pkg_filename"; while ($input =~ m/.../) { print $1; FH->print("$1\n") or die "could not write to $pkg_filename"; } I would have thought that to g

Re: trouble with writing to file

2004-03-01 Thread incognito
Thank you Bob and Owen. [Bob] > I notice you don't put an explicit path on the filename. Is it possible the > current directory is something other that what you expect it to be, and the > file is being successfully created in another location? I thought about that and so I tried an absolute path

Re: trouble with writing to file

2004-03-01 Thread Owen
On Mon, 1 Mar 2004 18:08:08 +0100 incognito <[EMAIL PROTECTED]> wrote: > open(FH, "> $pkg_filename") or die "could not create $pkg_filename"; > while ($input =~ m/.../) { > print $1; > FH->print("$1\n") or die "could not write to $pkg_filename"; > } I would have thought that to ge

RE: trouble with writing to file

2004-03-01 Thread Bob Showalter
incognito wrote: > Thank you for your attention, Bob. > > > What is your actual regex? At a minimum, you'll need /g modifier. > > You may need /m and/or /s as well. > > May be I didn't explained my prob exactly. > I don't have a problem with the regex (and yes, I have the /m /g and > /s). Related

Re: trouble with writing to file

2004-03-01 Thread incognito
Thank you for your attention, Bob. > What is your actual regex? At a minimum, you'll need /g modifier. You may > need /m and/or /s as well. May be I didn't explained my prob exactly. I don't have a problem with the regex (and yes, I have the /m /g and /s). Related to the regex, my script works fi

RE: trouble with writing to file

2004-03-01 Thread Bob Showalter
Reinhard Mantey wrote: > undef $/; > my $input = <>; > my $pkg_filename = "longnames.txt"; > > open(FH, "> $pkg_filename") or die "could not create $pkg_filename"; > while ($input =~ m/.../) { What is your actual regex? At a minimum, you'll need /g modifier. You may need /m and/or /s as well.

trouble with writing to file

2004-03-01 Thread Reinhard Mantey
Hello, I came to perl by J.Friedl's regex-book without any perl-experiences. I wrote a little script to scan packages and their dependencies from a book (lfs). The script works fine and I get the packages with their dependencies. Now I tried to expand that script that way, that I wanted to write

trouble with writing to file

2004-03-01 Thread incognito
Hello, I came to perl by J.Friedl's regex-book without any perl-experiences. I wrote a little script to scan packages and their dependencies from a book (lfs). The script works fine and I get the packages with their dependencies. Now I tried to expand that script that way, that I wanted to write

Re: Writing to file

2004-02-01 Thread R. Joseph Newton
Support wrote: > Hi all > I have a little bit of code you may be able to help with. > I load a file into an array with > > foreach $lines(@database_array) { >@edit_array = split(/\:/,$lines); >push(@member_array,[EMAIL PROTECTED]); >$x++; > } #loop > > and then play around with the a

Re: Writing to file

2004-02-01 Thread John W. Krahn
Support wrote: > > Hi all Hello, > I have a little bit of code you may be able to help with. I load a > file into an array with > > foreach $lines(@database_array) { You should limit the scope of $lines to the foreach loop. Does $lines contain multiple lines or just one line? Perhaps you sho

Re: Writing to file

2004-02-01 Thread Jeff 'japhy' Pinyan
On Feb 2, Support said: >foreach $lines(@database_array) { > @edit_array = split(/\:/,$lines); > push(@member_array,[EMAIL PROTECTED]); > $x++; >} #loop First, it doesn't look like you're using 'strict', which means you're not declaring your variables. This is probably going to lead to trou

RE: Writing to file

2004-02-01 Thread Hanson, Rob
So you need to dereference them. I think this is what you are after. join("\:",@{$member_array[$count]}); Rob -Original Message- From: Support [mailto:[EMAIL PROTECTED] Sent: Sunday, February 01, 2004 2:31 PM To: [EMAIL PROTECTED] Subject: Writing to file Hi all I have a little bit

Writing to file

2004-02-01 Thread Support
Hi all I have a little bit of code you may be able to help with. I load a file into an array with foreach $lines(@database_array) { @edit_array = split(/\:/,$lines); push(@member_array,[EMAIL PROTECTED]); $x++; }   #loop and then pl

Re: writing to file

2003-07-22 Thread denis
I stand corrected.. It should be ">" not ">>".. Should stop reading the list late at night.. Thanks On Tue, 22 Jul 2003 [EMAIL PROTECTED] wrote: > > On Mon, 21 Jul 2003 21:55:03 -0600 (MDT), [EMAIL PROTECTED] wrote: > > > open the file with ">>

Re: writing to file

2003-07-22 Thread wiggins
On Mon, 21 Jul 2003 21:55:03 -0600 (MDT), [EMAIL PROTECTED] wrote: > open the file with ">>" > This will cause an overwrite.. > Actually that is an "append". Maybe there is a definition issue, aka I would think of an "overwrite" to be a ">" where

Re: writing to file

2003-07-21 Thread denis
open the file with ">>" This will cause an overwrite.. On Mon, 21 Jul 2003, awarsd wrote: > Hi, > > I'm curious to know if it is possible to write to file with overwritting > information without putting into an array > if i have in a file > a > b > c > d > e > and i want to add g-r-t-u-x i wou

RE: writing to file

2003-07-21 Thread Charles K. Clarkson
awarsd <[EMAIL PROTECTED]> wrote: : : I'm curious to know if it is possible to write : to file with overwritting information without : putting into an array if i have in a file : : a : b : c : d : e : and i want to add g-r-t-u-x i would get : now in the file : : g : r : t : u : x : e <-- stays the

writing to file

2003-07-21 Thread awarsd
Hi, I'm curious to know if it is possible to write to file with overwritting information without putting into an array if i have in a file a b c d e and i want to add g-r-t-u-x i would get now in the file g r t u x e <-- stays the same no overwrite. any help is appreciated Anthony -- To unsu

Re: Question about writing to file

2002-03-28 Thread John W. Krahn
Richard Noel Fell wrote: > > Here is a subroutine that prints strings to a file. I want the routine > to write strings to the file in the format > Question1:factor(x^2+4*x+3)=(x+3)*(x+1). > However, what is written to file is > Question1:factor(x^2+4*x+3) > =(x+3)*(x+1), that is, > a newline befo

Re: Question about writing to file

2002-03-28 Thread Hans Holtan
Try removing the newline at the end of your question with a call to chomp. else{ for (my $i=1; $i<=$#qk+1;$i++){ chomp ($Question_hash{$qk[$i-1]}); print In1 "Question"."$i".":factor$Question_hash{$qk[$i-1]}=$Answer_hash{$ak[$i-1]}\n"; } >Here is a subroutine that prints strings to a file.

RE: Question about writing to file

2002-03-28 Thread Wagner-David
]] Sent: Thursday, March 28, 2002 11:26 To: [EMAIL PROTECTED] Subject: Question about writing to file Here is a subroutine that prints strings to a file. I want the routine to write strings to the file in the format Question1:factor(x^2+4*x+3)=(x+3)*(x+1). However, what is written to file is Question1

Question about writing to file

2002-03-28 Thread richard noel fell
Here is a subroutine that prints strings to a file. I want the routine to write strings to the file in the format Question1:factor(x^2+4*x+3)=(x+3)*(x+1). However, what is written to file is Question1:factor(x^2+4*x+3) =(x+3)*(x+1), that is, a newline before the = sign. Is there some way of inhib

Re: Writing to file not working......

2001-08-09 Thread Michael Fowler
On Thu, Aug 09, 2001 at 06:53:15PM -0500, CDitty wrote: > The email.txt file is an empty file and has the correct permissions. You're reading from a file, expecting data to be there, but the file is empty. Could this be your problem? > # This section needs to cycle through the emails.txt file

Writing to file not working......

2001-08-09 Thread CDitty
Can someone take a look at this and see what is wrong? I am still learning perl and this is giving me a tough time. The email.txt file is an empty file and has the correct permissions. Thanks Chris # This section needs to cycle through the emails.txt file. # Once it has cycled through the f