Is CYGWIN a unix like environment to run PERL modules?

2005-01-17 Thread Zapa Perl
Hello, I installed CYGWIN on Win-2000 hoping to have a Linux like environment and run PERL. I was expecting to click on the CYGWIN desktop icon and get a prompt window and move on. but that is not what I got. when I double click on CYGWIN desktop icon something flashes and disappears quickly a

Re: Counting occurences of a char in a line

2005-01-17 Thread Tor Hildrum
On Tue, 18 Jan 2005 01:08:56 +0100, Jenda Krynicky <[EMAIL PROTECTED]> wrote: > foreach my $line () { > if ( $line =~ /^[^,]*(?:,[^,]*){10}$/) ) { > print OUT $line; > } > } > > That is check whether the full string is "something not containing > comma followed by ten times comma

Re: Substitute Varaible

2005-01-17 Thread Anish Kumar K.
Thanks it is working fine Anish - Original Message - From: "Dave Gray" <[EMAIL PROTECTED]> To: "beginners perl" Sent: Monday, January 17, 2005 11:43 PM Subject: Re: Substitute Varaible > On Mon, 17 Jan 2005 16:11:54 +0530, Anish Kumar K. > <[EMAIL PROTECTED]> wrote: > > Hi I need

Re: calling Tcl script with ato arguments

2005-01-17 Thread Randy W. Sims
Vladimir Lemberg wrote: Hi All, Could you help me to solve following problem: I need to execute tkl script with two arguments (input file and output file) within my Perl script: #!/usr/bin/perl -w use strict; use File::Basename; my @gdflist = `find . -name *.gdf`; my $gdf_number = scalar(@gdflist)

calling Tcl script with ato arguments

2005-01-17 Thread Vladimir Lemberg
Hi All, Could you help me to solve following problem: I need to execute tkl script with two arguments (input file and output file) within my Perl script: #!/usr/bin/perl -w use strict; use File::Basename; my @gdflist = `find . -name *.gdf`; my $gdf_number = scalar(@gdflist); my $counter = 0;

Re: writing newfile to a dir

2005-01-17 Thread JupiterHost.Net
Brian Volk wrote: JupiterHost.Net wrote: Brian Volk wrote: Hi All, Hello, I created a script that renames a dir of MP3 files... Everything is Perhaps File::Copy::Recursive can assist you in this? http://search.cpan.org/~dmuey/File-Copy-Recursive-0.02/Recursive.pm use File::Copy::Recursive 'dirc

Re: Reading the first line of a file

2005-01-17 Thread Stone
> > if ($_ !~ /\*{5} InTune/){ > This should be: > if ($_ !=~ /\*{5} InTune/) { Please ignore this. Your use of the operator is correct. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: writing newfile to a dir

2005-01-17 Thread Brian Volk
JupiterHost.Net wrote: Brian Volk wrote: Hi All, Hello, I created a script that renames a dir of MP3 files... Everything is Perhaps File::Copy::Recursive can assist you in this? http://search.cpan.org/~dmuey/File-Copy-Recursive-0.02/Recursive.pm use File::Copy::Recursive 'dircopy'; dircopy($ori

Re: writing newfile to a dir

2005-01-17 Thread JupiterHost.Net
Brian Volk wrote: Hi All, Hello, I created a script that renames a dir of MP3 files... Everything is Perhaps File::Copy::Recursive can assist you in this? http://search.cpan.org/~dmuey/File-Copy-Recursive-0.02/Recursive.pm use File::Copy::Recursive 'dircopy'; dircopy($orig,$new) or die "Copying

RE: Spam:Re: Reading the first line of a file

2005-01-17 Thread Michael Kraus
G'day... > > if ($_ !~ /\*{5} InTune/){ > > This should be: > > if ($_ !=~ /\*{5} InTune/) { Should it? I always thought that !~ was the inverse of =~ I.e. $var !~ /pattern/ was the equivalent of !($var =~ /pattern/) (at least within test conditions anyway) Is there somethi

Re: Counting occurences of a char in a line

2005-01-17 Thread Jenda Krynicky
From: Tor Hildrum <[EMAIL PROTECTED]> > I have the following code in a script I'm writing: > > foreach my $line () { > if ( 10 == ($line =~ s/,/,/g) ) { > print OUT $line; > } > } > > Is this poor style? It looks a bit ugly, but I can't figure out a > better way to do it. I'm sure

writing newfile to a dir

2005-01-17 Thread Brian Volk
Hi All, I created a script that renames a dir of MP3 files... Everything is working well except when I try to write the new files to a directory. I thought I could print to a dirhandle, apparently not.. :~) Maybe I need to mv the $newfile...? not sure... Any help would be greatly appreciat

Re: regular expression question

2005-01-17 Thread Chris Devers
On Mon, 17 Jan 2005, Vincent wrote: > I am new to perl, I receive some spam email with subject like "st0ck, > 0pportunities, gr0wth...", how can I match those words with number "0" > in You don't. I spent a about a year doing pretty much what you're asking for here, though with Procmail rules

Re: Reading the first line of a file

2005-01-17 Thread Stone
> is there a way to add a -e to check to see if we have a file to unlink ? How about: open (FH, UPLOAD_DIR . "/$file") || die ( $q, "Error reading $file for test : $!" ); That will stop processing at that point, if you aren't able to open the file for any reason (like it doesn't exist). Other

Re: regular expression question

2005-01-17 Thread Stone
On Mon, 17 Jan 2005 16:04:48 -0500, Dave Gray <[EMAIL PROTECTED]> wrote: > > I am new to perl, I receive some spam email with subject like "st0ck, > > 0pportunities, gr0wth...", how can I match those words with number "0" in What about something like this: if ( $subject =~ /(^0[a-zA-Z]+)|([a-zA-Z

Reading the first line of a file

2005-01-17 Thread David Gilden
Greetings, The second piece of code should look for "* InTune " somewhere in the first line of the file if it does not, it should unlink the bad file and fire off the error, it seems to happen all the time regardless of the match. Two quick questions here: I can't see why I am getting thi

Re: replacing multiple matches with an array

2005-01-17 Thread John W. Krahn
B McKee wrote: Hi All Hello, I have this bit of code in a program I'm working on. while () { next if /\f/ ; next if /^DATE : / ; next if /^\s{15,}PART / ; next if /^COUNTER QTY/ ; next if /^\s+$/ ; print ;

Re: replacing multiple matches with an array

2005-01-17 Thread JupiterHost.Net
Hello, I believe this will do what you want: next if grep { $rawreport_item =~ /$_/ } @possibleMatches; Just make sure the regexes in @possibleMatches are not user supplied or they may try sneaky bad things :) perl -mstrict -we 'my @m = (q(^\d+$), q(^\w+$)); for my $item (qw(123 abc 1-2we)){ n

Re: Forcing script to run as root?

2005-01-17 Thread John W. Krahn
[EMAIL PROTECTED] wrote: Hi all. How can I check, within a script, to see if it is being run as root or not? I would like it to exit with an error message if it is not running as root. I'm looking for something that works across *nix platforms so that my script is portable. Is there a perl function

Re: regular expression question

2005-01-17 Thread Dave Gray
> I am new to perl, I receive some spam email with subject like "st0ck, > 0pportunities, gr0wth...", how can I match those words with number "0" in Something like __CODE__ use warnings; use strict; use Data::Dumper; # add to this hash to make it slower my %rep = ( 'a' => [4], 'e' => [3], '

replacing multiple matches with an array

2005-01-17 Thread B McKee
Hi All I have this bit of code in a program I'm working on. while () { next if /\f/ ; next if /^DATE : / ; next if /^\s{15,}PART / ; next if /^COUNTER QTY/ ; next if /^\s+$/ ; print ; # debugging purpo

regular expression question

2005-01-17 Thread Vincent
Hi all, I am new to perl, I receive some spam email with subject like "st0ck, 0pportunities, gr0wth...", how can I match those words with number "0" in Thanks in advance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: Counting occurences of a char in a line

2005-01-17 Thread John W. Krahn
Tor Hildrum wrote: Hi, Hello, I have the following code in a script I'm writing: foreach my $line () { if ( 10 == ($line =~ s/,/,/g) ) { print OUT $line; } } Is this poor style? It looks a bit ugly, but I can't figure out a better way to do it. I'm sure there is :) The script will b

Re: separating list alphabetically

2005-01-17 Thread John W. Krahn
Tim McGeary wrote: I have some data that needs to be split up alphabetically into lists that start with each letter of the alphabet. Sample data is like the following with real URL data in place of URL1 and URL2. Only the first field is important for alphabetizing. If I do an array with each

Re: Substitute Varaible

2005-01-17 Thread John W. Krahn
Anish Kumar K. wrote: Hi I need help regarding substituion of varaibles with values That is a Frequently Asked Question. perldoc -q "How can I expand variables in text strings" Say I have a txt file (a.txt) which has only one line: Hi $name The PL file open INPUT, "a.txt"; You should *ALW

Re: Problem using CGI::Session

2005-01-17 Thread Octavian Rasnita
Hi again, Sorry for my previous post. I found the problem. I wrote by mistake: use CGI::session; (with a small "s" and this sometimes work under Windows, but sometimes for some tasks it doesn't. And that's why perl didn't tell me that it couldn't find that module. Teddy - Original Messa

Re: Forcing script to run as root?

2005-01-17 Thread Tor Hildrum
On Mon, 17 Jan 2005 14:08:10 -0500, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Worked perfectly. I knew it was something simple. Thanks! > > Never used POSIX before. Looked at it on cpan but those descriptions can be > flat sometimes. If you don't mind, what are some practical uses for it? Jus

Problem using CGI::Session

2005-01-17 Thread Octavian Rasnita
Hi all, I have tried using the module CGI::Session with MySQL. If I try $session->id; It prints fine the hash of the current session, but if I try to print $session->name; or $session->header; It gave me the following error: Can't locate auto/CGI/Session/MySQL/name.al in @INC (@INC contains:

Re: losing a value after chomp()

2005-01-17 Thread Tor Hildrum
On Mon, 17 Jan 2005 17:57:28 +, RichT <[EMAIL PROTECTED]> wrote: > Hi All, > >time for me to ask dumb questions again... > > I have a script, what i want it to do is scan through a Cisco > router Config file (nicely saved in a text file already so no need for > and SNMP), then outpu

Forcing script to run as root?

2005-01-17 Thread brian . barto
Hi all. How can I check, within a script, to see if it is being run as root or not? I would like it to exit with an error message if it is not running as root. I'm looking for something that works across *nix platforms so that my script is portable. Is there a perl function that does this or perhap

Net::FTP and filehandle with get()

2005-01-17 Thread steve abrams
Hi all, First post to the group. I have two questions, but they go hand in hand. The first: Net::FTP documentation reports that get syntax is: get ( REMOTE_FILE [, LOCAL_FILE [, WHERE]] ) I do the following (with $ftp initialization omitted here): local $fh = IO::File->new_tmpfile; $ftp->get($dum

Re: Substitute Varaible

2005-01-17 Thread Dave Gray
On Mon, 17 Jan 2005 16:11:54 +0530, Anish Kumar K. <[EMAIL PROTECTED]> wrote: > Hi I need help regarding substituion of varaibles with values > > Say I have a txt file (a.txt) > > which has only one line: > Hi $name > > The PL file > use strict; use warnings; > open INPUT, "a.txt"

losing a value after chomp()

2005-01-17 Thread RichT
Hi All, time for me to ask dumb questions again... I have a script, what i want it to do is scan through a Cisco router Config file (nicely saved in a text file already so no need for and SNMP), then output it to a .csv file. I an using the Cisco::Reconfig; module to help me out. My

Re: Regex help

2005-01-17 Thread Dave Gray
On Mon, 17 Jan 2005 08:37:07 +0100, manfred <[EMAIL PROTECTED]> wrote: > > That leads me to a question :-) > > >> if ($num =~ /^(\d+)\#([^\#]*?)\#(?:e\+(\d+))?$/x) { > > What particular use has the _x_ modifier in this example? > I mean the hashes are escaped? I forgot to remove the /x when I

RE: Counting occurences of a char in a line

2005-01-17 Thread Bakken, Luke
> Hi, > > I have the following code in a script I'm writing: > > foreach my $line () { > if ( 10 == ($line =~ s/,/,/g) ) { > print OUT $line; > } > } > > Is this poor style? It looks a bit ugly, but I can't figure out a > better way to do it. I'm sure there is :) > The script wil

Counting occurences of a char in a line

2005-01-17 Thread Tor Hildrum
Hi, I have the following code in a script I'm writing: foreach my $line () { if ( 10 == ($line =~ s/,/,/g) ) { print OUT $line; } } Is this poor style? It looks a bit ugly, but I can't figure out a better way to do it. I'm sure there is :) The script will be reused and probably m

perl.beginners Weekly list FAQ posting

2005-01-17 Thread casey
NAME beginners-faq - FAQ for the beginners mailing list 1 - Administriva 1.1 - I'm not subscribed - how do I subscribe? Send mail to <[EMAIL PROTECTED]> You can also specify your subscription email address by sending email to (assuming [EMAIL PROTECTED] is your email address):

RE: separating list alphabetically

2005-01-17 Thread Bakken, Luke
> I have some data that needs to be split up alphabetically into lists > that start with each letter of the alphabet. Sample data is like the > following with real URL data in place of URL1 and URL2. Only > the first > field is important for alphabetizing. If I do an array with > each lette

separating list alphabetically

2005-01-17 Thread Tim McGeary
I have some data that needs to be split up alphabetically into lists that start with each letter of the alphabet. Sample data is like the following with real URL data in place of URL1 and URL2. Only the first field is important for alphabetizing. If I do an array with each letter (and it can

RE: CGI.pm and form creation

2005-01-17 Thread Moon, John
I'm trying to create a little form usign CGI.pm but I get this error from apache: malformed header from script. Bad header='usr',-checked=>1), checkbox(-name=>'sys',-checked=>0), checkbox(-name=>'wio',-checked=>0), checkbox(-name=>'idle',-checked=>0), reset(-nam

Re: CGI.pm and form creation

2005-01-17 Thread Tor Hildrum
On Mon, 17 Jan 2005 14:41:40 +0100, Mauro <[EMAIL PROTECTED]> wrote: > I'm trying to create a little form usign CGI.pm but I get this error from > apache: > malformed header from script. Bad header= checkbox(-name=>'usr',-checked=>1), > checkbox(-name=>'sys',-checked=>0), >

CGI.pm and form creation

2005-01-17 Thread Mauro
I'm trying to create a little form usign CGI.pm but I get this error from apache: malformed header from script. Bad header='usr',-checked=>1), checkbox(-name=>'sys',-checked=>0), checkbox(-name=>'wio',-checked=>0), checkbox(-name=>'idle',-checked=>0), reset(-na

Re: Can perl produce a huge-sized file for download testing?

2005-01-17 Thread Gavin Henry
> On Sun, 16 Jan 2005 22:53:29 -0800 (PST), [EMAIL PROTECTED] (Harold > Castro) wrote: > >>Hi, >> Our company is involved in internet service >>providing, and as such, troubleshooting our partner's >>links is one of our day to day activities. We have our >>own network monitoring system using mrt

Re: Can perl produce a huge-sized file for download testing?

2005-01-17 Thread Chris Devers
On Mon, 17 Jan 2005, Robin wrote: > On Monday 17 January 2005 19:53, Harold Castro wrote: > > versa. What I'm thinking now is to create a simple > > perl script that will create a file, as huge as it can > > be, or just a continues stream of dummy bytes being > > uploaded to a remote host. Only I

XS problem.

2005-01-17 Thread Jesper Krogh
Hi. I'm trying to make perl bindings for the GnuTLS library, but I'm having som problems with h2xs when generating XS-stubs: $ h2xs -x /usr/include/gnutls/gnutls. Defaulting to backwards compatibility with perl 5.8.4 If you intend this module to be compatible with earlier perl version specify a

Re: Substitute Varaible

2005-01-17 Thread Tor Hildrum
On Mon, 17 Jan 2005 16:11:54 +0530, Anish Kumar K. <[EMAIL PROTECTED]> wrote: > Hi I need help regarding substituion of varaibles with values > > Say I have a txt file (a.txt) > > which has only one line: > Hi $name Don't think of $name as a perl variable, but as a placeholder. It looks better i

Substitute Varaible

2005-01-17 Thread Anish Kumar K.
Hi I need help regarding substituion of varaibles with values Say I have a txt file (a.txt) which has only one line: Hi $name The PL file open INPUT, "a.txt"; my $name="Anish"; my $temp=""; while () { $temp=$temp.$_; } close(INPUT); print "Content is: $temp"; In the output I want the

Can;t locate the module

2005-01-17 Thread Anish Kumar K.
Hi I tried this Chart::ThreeD::Pie module. Installation doesn't show any error.. I am getting this error... In the line 21, I have use GD; How will I install this module.. please help me Can't locate GD.pm in @INC (@INC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /usr/lib/perl