Reg Exp Help

2005-03-09 Thread Trina Espinoza
Var $machine_status contains this block of data: machine_status = "Pinging 129.111.3.79 with 32 bytes of data: Request timed out. Request timed out. Request timed out. Request timed out. Ping statistics for 192.111.3.79: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), Approximate round tr

cmd prompt = success in perl?

2004-07-13 Thread Trina Espinoza
Does getting a return cmd prompt equate to a successfully run script? My perl script runs everything correctly, but when the script finishes I see a mix of results. Sometimes it returns to the command prompt, sometimes I get a delayed cmd prompt (takes a minute or so to return), and sometimes I

List as a value of a hash???

2004-06-21 Thread Trina Espinoza
Have a question regarding hashes. Lets say I wanted a list as one of the values in my hash for the reason that I would want to constantly push values into that list. .. $dataHash{"$fileName"}{count} = 1; $dataHash{"$fileName"}{increment} = push(@array,$fileNumber); ###PROBLEM HERE! $dataHash{"$f

multidimentional hash that has both two and three keys

2004-01-29 Thread Trina Espinoza
Can you have a multidimentional hash that has both two and three keys? For example: Array with two keys and a value: $HASH-> {$VAR}{letter} ="a"; Same Array with three keys and a value: $HASH->{$VAR}{$number){float} = "1.1"; $HASH->{$VAR} {$number}{integer}="2"; Is this possible? I'm not sure if

Re: function that reads line numbers?

2004-01-28 Thread Trina Espinoza
d see what best suites my task. It's nice to have options when trying to solve a problem, so thanks everyone :) -T - Original Message - From: "Owen Cook" <[EMAIL PROTECTED]> To: "Trina Espinoza" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sen

function that reads line numbers?

2004-01-27 Thread Trina Espinoza
So this may be wishful thinking, but I would be kicking myself later if I didn't ask. Is there a function in perl where you give the function exact line numbers and it would only read the data in the range of lines you gave it? My other alternative would be using a counter to find a start line a

Saying an item is empty

2004-01-19 Thread Trina Espinoza
I would like to know how I would say if $item equals $tempitem OR if $item is empty(the variable is a placeholder that has nothing in it), execute command. Are either of these saying the above statement because I don't seem to be getting the expected results. If ($item =~ /^(\D+)(\d+)/ {)

passing DOS command in perl

2003-10-23 Thread Trina Espinoza
Trying to send a DOS command using perl, but get a little confused as to how this changes when passing this in as a system call in perl. The DOS command: C:\>del /q /S "c:\Documents and Settings\test\Local Settings\Temp\*.*" When I run the command in perl I try escaping the second set of quotes

Regular Expression question

2003-10-09 Thread Trina Espinoza
How do you create a regular expression that allows you to have files like ths: Stuff_Dev Greg_Files myThings_ _default I wrote this s/([A-Za-z]*)/\n$1/g; It only gets the letters, but I am not sure how to write in the underscore. Any attemps I have made on adding the _ get the wrong results e.

make changes to a file, then reading in those changes. . .

2003-10-06 Thread Trina Espinoza
I have a file that I want to run multiple actions on. First, the file is read in as one long string. I want to substitute some words with others so I run a substitution. That seems to change the data in the first while, HOWEVER, when I run the second while loop on the same data to parse my newly

Re: Regular Expressions and the sub command

2003-10-06 Thread Trina Espinoza
Thanks for the help! This worked perfectly! -T From: Casey West <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: Trina Espinoza <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: Regular Expressions and the sub command Date: Mon, 6 Oct 2003 13:33:25 -0400 It was Monday, Octo

Regular Expressions and the sub command

2003-10-06 Thread Trina Espinoza
I am running this command on a $file, s/[A-Z^_]*_Leq/\n[A-Z^_]*_Leq/g; but the output I get takes the regular expression literally, so I get: [A-Z^_]*_Leq [A-Z^_]*_Leq [A-Z^_]*_Leq What I would like to get is something like this: AB_Leq What can I do to prevent it from taking A-Z^_]*_ literally

Re: GetOpts: boolean and argument value combos

2003-09-23 Thread Trina Espinoza
gain :) -T > > > > > > - Original Message - > > From: "Trina Espinoza" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, September 23, 2003 6:10 PM > > Subject: GetOpts: boolean and argument value combos > > >

GetOpts: boolean and argument value combos

2003-09-23 Thread Trina Espinoza
Hey Perl Peps, I am stuck in the mudd and hoping someone can give me a few clues that will help get me back on track. I want to submit some arguments like so: ./script1.pl -book -title HP3 -chapter 04 NOTE: -book does not have an argument Now I have been using GetOpt::Long and everything wor

reading STDERR

2003-09-11 Thread Trina Espinoza
I have this command that reads logfiles.However, if the command isn't successful it gives me a standard error. my @logData= `program1 -log $data1 $data2`; The error looks like this: program1: '//mnt/leah/dir/': The system cannot find the file specified. *How do I read that error for the st

What does $| mean?

2003-09-03 Thread Trina Espinoza
Saw it in a piece of code but have no clue what it does. Any suggestions would be greatly appreciated. -T

012 and 015 eq \r and\n on what conversion chart?

2003-08-27 Thread Trina Espinoza
tr/\012\015//d; So a while back ago, there was someone kind enough to pass me the above snippet of code, which removes returns and newlines from data attained by perl. It works great and I would like to find the conversion table that was used so I can obtain the numbers to rid my code of other a

Re: Setting shell enviro through perl?

2003-08-21 Thread Trina Espinoza
Does anyone know how to set an shell enviroment using perl? I have tried using the backticks, the system command, but they don't seem to be working. I found ENV{'FLEE'} = 'FLEE'; online, but I don't understand how that works. It sets your enviroment for a child process but won't change your cu

Re: the File::Copy module

2003-08-20 Thread Trina Espinoza
I only know the first part. qq is double quotes. As opposed to the qw which is single quotes. Good for interpolating! -T - Original Message - From: "Saadat Saeed" <[EMAIL PROTECTED]> To: "Dan Muey" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, August 19, 2003 11:07 PM Subjec

Re: Cron jobs and perl

2003-08-18 Thread Trina Espinoza
Sorry for being so unresponsive Vema! I was away from my desk when you had your problems. Unfortunately, I am still trying to get my cron job working. My job seems to pick up fine, but then it drops the path half way through because it doesn't understand the path.The path is an absolute path which

Cron jobs and perl

2003-08-16 Thread Trina Espinoza
les. Also, are my escaping the spaces with slashes in Documents\ and\ Settings contributing to the problem? Does UNIX not escape spaces like perl? Thank you, Trina Espinoza

Script chokes on various file formats.

2003-08-14 Thread Trina Espinoza
I am starting to write a lot of scripts that require a user to input a file that my script processes for data. Since there are may file formats rtf, txt, microsoft word, etc, my scripts have often choked when users submit the data in various file formats. I need something to ensure my scripts d

putting list into value for hash key

2003-08-14 Thread Trina Espinoza
I have a hash that contains keys, but does not yet have values. How do you push a list of an item into the value for a particular key? I tried doing this example below, but it does not seem to be working. Is there anything wrong with the way this is written? Can someone give me suggestions for t

data not pushing to list

2003-08-14 Thread Trina Espinoza
Is there any reason why this doesn't print the @missing? Ive also tried unless ($myhash{$elem} == 1) { push(@missing, $frame) } Any insight into what I'm doing wrong would be greatly appreciated. Thanks! -T CODE: @missing = ""; @framelist= (1, 2, 3, 6, 10); $sta

Getting rid of returns

2003-08-14 Thread Trina Espinoza
Let me start of with a smaller question. . .. How do you get rid of returns? I known chomp gets rid of new lines, but I don't know how to get rid of returns. My code accepting data from the user. I just need to start by filtering out \n's and \r's I tried the code (snippet below), but there seem

CPAN Module delivers error . . .

2003-08-11 Thread Trina Espinoza
Hello All, I an trying to install the getOpt module from CPAN and have been following the Windows95-NT with the core Windows distrubution of Perl. I downloaded and unziped the module and did a perl Makefile.PL in the directory. However when I do a make test I get the following error message: $

Getting string of several lines from <>

2003-08-06 Thread Trina Espinoza
Wondering if someone can help bail me out. I would like to have the data of <> as one long string. Right now I have @list = <> because if I do $scalar= <> it only captures one line of my file. However, what I really need is to capture the data as one long string. Can anyone deliver a swift answ