RE: "\s" eq "\b" ?

2004-04-14 Thread Mark Anderson
-Original Message- From: Jayakumar Rajagopal [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 14, 2004 11:16 AM To: Beginners Perl Subject: "\s" eq "\b" ? hi friends, in regexp, I feel \s and \b behaves same. can someone send me a contradiction ? thanks, Jay -End Orig Message-

RE: Only reading even lines in file -skipping odd ones!

2004-03-02 Thread Mark Anderson
> i am trying to write a perl script to tidy up any lines in a file that don't > contain alphabetic characters or single instances of character. i've noticed > that the even lines are being skipped when read in eg 0,2,4,6 - the script > is run on window - any ideas? > while () { This line reads

RE: Delimiter for string..

2004-02-04 Thread Mark Anderson
> I am running a perl script as below which is working perfectly and want to > replace the hardcoded values with variables. > (the script accepts space as the delimiter) > @respon = $placesock->print("./test.pl \"7741266\" \"DEM EXPO\" > \"255.255.255.255\" \n"); > > and i am doing this > > @resp

RE: help on regular expression

2004-01-28 Thread Mark Anderson
> Hi, >I need some help on regular expression... > i have following in variable $total_count > > $total_count = "##I USBP 01 10:38:09(000) > ETRACK_TOTAL_RECS : 100" > > Here in this ETRACK_TOTAL_RECS is fixed and common for > all and rest is changing... > > like following > > $total_coun

RE: Match the first 3 characters of 2 words?

2003-12-10 Thread Mark Anderson
Response at end of message... -Original Message- From: Rod [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 10, 2003 12:19 PM To: '[EMAIL PROTECTED]' Subject: Match the first 3 characters of 2 words? What is the easiest way to test the first 3 characters of two words for a match. IE

RE: search

2003-11-21 Thread Mark Anderson
> From: Eric Walker [mailto:[EMAIL PROTECTED] > Sent: Friday, November 21, 2003 1:34 PM > Subject: search > > > I am trying to search a string for a "[]". I want to count the amount > of "[]" in the string. > > Any IDeas perldoc -q count gives you: How can I count the number of occurren

RE: substitution problem

2003-10-23 Thread Mark Anderson
> From: Steve Massey [mailto:[EMAIL PROTECTED] > Sent: 23 October 2003 11:33 > > #! /usr/bin/perl -w > > $test = "BRIGHTON (Firm)"; > > > print "$test\n"; > $test =~ s/,*/,/; > $test =~ s/,*$/,/g; > > print "$test\n"; It looks like the +/* issue has bee

RE: matching help needed

2003-10-20 Thread Mark Anderson
> using the following code.. I am looking to match any text that has a date in > it ie 8-Nov, nut my code also matches 8-11b, which is not what I want > > #! /usr/bin/perl -w > > $test = "8-11b1"; > ##$test = "8-Nov1"; > > if ( $test =~ /(\d{1,2})\-(\w{3})([\d\w]*)/) { > $day = $1;

RE: Case conversions

2003-08-15 Thread Mark Anderson
> Any one have or know of a function to convert ugly "NAME, USER" to "User Name"? timtowtdi: $str = "User Name" if ($str eq "NAME, USER"); $str =~ s/^NAME, USER$/User Name/; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: comparing more than one list

2003-07-24 Thread Mark Anderson
> Hi to [EMAIL PROTECTED] This is my first posting so please be gentle. > I've followed the comparing two lists thread with interest. What I'd like > to do is to compare 16 lists to see whether each of the entries in e.g. > list 1 is present in one or more of the other 15. Each entry in the list

RE: Regex extraction skipping lines

2003-07-18 Thread Mark Anderson
> Anyone have any ideas about this - is there a common mistake I might be > making here? > > I am using a simple regex to extract a few pieces of every line of a 2000+ > line text file then spitting it back into a second text file. I can't figure > out why but the output file always includes every

RE: Getting the domain name

2003-07-15 Thread Mark Anderson
> We have a fairly simple redirect script a url is entered, and even tho there are > directions to not enter the "http://www"; sometimes we get it or "http://";... > what is the simplest method to extract just the domain name if a > "http://www.somedomain_name.com"; or "http://somedomain_name.com";

RE: Hey, I mapped something without training wheels

2003-06-06 Thread Mark Anderson
> (Forgive the excitement) Not a problem. Congratulations. > I just reversed the %n2m construct - the original builds a hash using map > that lets you convert numbers to months, etc. (I probably found it here). > > In keeping with my feeling that with 'map' one can do almost anything (if I > kne

RE: [mail_lists] Re: regex $1 not updating?

2003-04-04 Thread Mark Anderson
Go back and re-read John's message. Then look at your conditionals. They are different. His work, yours don't. Yours: 87 $back =~ /.*\(.*\) (.*?) .*/; 88 89 if ( $1 ) 103 $line =~ /.* \(.*\) (.*?) .*/; 104 105

RE: LABELS, forks and foreach loops.....

2003-03-27 Thread Mark Anderson
--- Original message --- foreach $hostId ( @hostIds ) { my $pid = undef; $pid = fork if $CHILD_PIDS < $MAX_CHILDREN; if( $pid > 0 ) { $CHILD_PIDS++; #Add the children up until we hit the

RE: COunting the number of times a string matches in another string

2003-03-12 Thread Mark Anderson
> > The following works the same and may or may not be easier to > > understand/maintain. > > $tokenCount{$_} is automatically created with a value of 0 when first > > called, and > > then is incremented to 1, so you don't have to test or create it yourself. > > > > my @tokens = split /:/; > > f

RE: COunting the number of times a string matches in another string

2003-03-12 Thread Mark Anderson
> It sounds like you need a count hash. You might try something like: > > my @tokens = split /:/; > foreach (@tokens) { >if ($tokenCount{$_}) { > $tokenCount{$_}++; >} else { > $tokenCount{$_} = 1; >} > } The following works the same and may or may not be easier to unders

RE: return a regex substitution in one line

2003-03-11 Thread Mark Anderson
> I have this subroutine and it does what I need :: > > print rmgtlt($var); > > sub rmgtlt { > $_[0] =~ s/^\<|\>$|\n|\r|\s$//g; > return $_[0]; > } > > Is there a way to so the substitution and return the result in one line? > > Like :: > > sub rmgtlt { > return ??? $_[0] =~ s/^\<

RE: Production Mode: Warnings?!

2003-03-10 Thread Mark Anderson
> I'm just trying to get a general feeling here from the community. > > I have a script that I am getting ready to turn over in "production mode". I > am using 'use strict' of course, and during my coding and testing, have > enable warnings. > > Now that the code is ready to "go production", shoul

RE: trying to match variable names

2003-03-06 Thread Mark Anderson
> > I'm trying to write a script that reads a file line by line and if the line > > contains a space it puts quotation marks around it and writes it to another > > file. I mostly have this working except that in the case of the lines that > > contain the space it puts the quotation mark at the

RE: trying to match variable names

2003-03-06 Thread Mark Anderson
You probably should have started a new thread for this discussion. > I'm trying to write a script that reads a file line by line and if the line > contains a space it puts quotation marks around it and writes it to another > file. I mostly have this working except that in the case of the lines th

RE: Help! What am I doing wrong?

2003-03-06 Thread Mark Anderson
[most of message cut for clarity, see original for context] > Now, I have an internally developed function > (the internal of which are hidden from me) which > processes the email addresses. This takes as one > of it's parameters an array of strings. > So before I call the function I say: > @AddrL

RE: removing elements from an array

2003-03-05 Thread Mark Anderson
> Hi, > I would like to remove elements from an array that are eq to string '0' > The following does not work, can someone shed some light on the proper > way to do this. > Thanks! > Dave G. look at the grep function: perldoc -f grep -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional

RE: regex to capture all combinations of .. and [ ]

2003-02-28 Thread Mark Anderson
> This (perl -n -we 'print if /[\[\].]{2}/;' file) almost did the trick, but > it was also picking up lines with many .. or many flanked > in between something. So I ammended it to (as there is always a space > between the characters I am trying to pull out): > > perl -n -we 'p

RE: Removing a string from within a string

2003-02-25 Thread Mark Anderson
>> I have another problem, I have a string of nicknames that looks like: >> >> $mystring1 = "nick1,nick2,nick3,nick4,nick5"; >> >> I've asked this question before, but because of my bad regex >> knowledge, I'm asking again, but this time in a slightly different >> context. The last time I asked,

beginners@perl.org

2003-02-25 Thread Mark Anderson
> Basic question on using '&&' vs 'and'. I see that '&&' has higher precedence > than 'and', but why does > > print 1 && 1 && 0; > print "\n"; > print 1 and 1 and 0; > print "\n"; > > return > 0 > 1 > > I would have expected both statements to return 0. >From a couple of experiments, I wou

RE: CSV inports...

2003-02-20 Thread Mark Anderson
> I have a MS Excel exported CSV text file, with , separated values. The > problem now, is that some of the values also contains a , character, and MS > Excel thus put the values in a quote such as: > "blah, blah", blah, "blah, blah, blah" > > How would I go about fixing this little issue? T

RE: matching patterns

2003-02-04 Thread Mark Anderson
> I am trying to extract ".jpg" (subtype of the file) from the string: > c:\my_files\file.jpg > > I found the following pattern on the net: > $file =~ s/.*[\/\\](.*)/$1/; > which extracts the file name (file.jpg). I understood most of that pattern > except what does the (.*) part does? And how ca

RE: Ref - Hash of Arrays

2003-02-03 Thread Mark Anderson
>I have a hash of arrays. Here is a sample of one of the elements > >$hoa{key}=[2,somestring,someotherstring]; > >If I where to print it like this > print "$#{hoa{key}}" >It print 2. I'm pretty sure this isn't your actual code. >From how I understand this $# is dereferencing and should pr

RE: Help about Regex

2003-01-29 Thread Mark Anderson
Is this in pseudocode or in working code? I would guess that it is some sort of meta- for tilde (~), since you need =~ before the s/// construct. /\/\ark -Original Message- From: lielie meimei [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 29, 2003

RE: Trouble with hash lookup

2003-01-28 Thread Mark Anderson
>Should be a simple question. I am trying to only print the element of the > hash, that matches the $user string but it prints all of the elements. What > am I missing. print "$lookup{$user}\n"; > Thanks > > $user = "jsmith"; > my %lookup = ( > 'jsmith' => "jsmith1", > 'djones'

RE: Regular Expression's and punctuation

2003-01-27 Thread Mark Anderson
LS> I have a script that is used for text messaging. I added a LS> line of code to check to make sure that input is in a field LS> before the message is sent. My code is as follows: LS> LS> if($b !~ m/^\w[\w\s]*\w$/) { $error .= "Enter a message \n"; } LS> LS> This fails if the field has any

RE: Regular Expression's and punctuation

2003-01-27 Thread Mark Anderson
>I have a script that is used for text messaging. I added a line of code to >check to make sure that input is in a field before the message is sent. My >code is as follows: > >if($b !~ m/^\w[\w\s]*\w$/) { $error .= "Enter a message \n"; } > >This fails if the field has any punctuation characters.

RE: determining location of character in array....

2003-01-16 Thread Mark Anderson
> Is there an easy way to get the location of a specific instance of a > character in an array? > > for example: > >$MyArray = "This is the test"; > > I would like to know the index of the first occurence of the letter "h" ( 1 perldoc -f index index $MyArray,'h'; -- To unsubscribe, e-mail

RE: Better explanation - Adding to Mult-dimensional array of arrays

2003-01-15 Thread Mark Anderson
> But what I really want to do is this : > > push( @MyArray[0], 2 ); > push( @MyArray[0], 3 ); > > push( @MyArray[1], 4 ); > push( @MyArray[1], 5 ); > push( @MyArray[1], 6 ); I apologize. My first response was incorrect. You need: push( @{$MyArray[0]}, 2 )

RE: Adding to multi-dimensional array dynamically via push...

2003-01-15 Thread Mark Anderson
> I would like to know if it is possible to do somthing like this: > ( I know I can't do it this way as Perl barfs when I tried it ) > > $SizeOfMyArray = 2; > > $MyArray[ $SizeOfMyArray ]; Why are you trying to define the size of your array? > push( @MyArray[ 0 ], 0 ); << --- complains

RE: read file in from bottom instead of top

2003-01-13 Thread Mark Anderson
> I have tried to read a file in backwards in stead of from the top > without any success !!! http://search.cpan.org/author/URI/File-ReadBackwards-0.99/ReadBackwards.pm /\/\ark -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAI

RE: Epoch midnight

2003-01-10 Thread Mark Anderson
> What exactly would I enter if I want a program to find the epoch time for > midnight each night? I know how to find "current" time and date in both > "human" time and epoch time. I can't give you code, because I haven't worked with perl's various time functions, but logically, I would get the

RE: Reqxp help

2003-01-09 Thread Mark Anderson
-Original Message- From: Jensen Kenneth B SrA AFPC/DPDMPQ [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 09, 2003 10:59 AM To: '[EMAIL PROTECTED]' Subject: Reqxp help Trying to make a one liner regxp to covert a file. File has lines like these (lines are preceded with a space) Dec

RE: Sorting hash "values"

2002-12-30 Thread Mark Anderson
It helps to answer your question if you show us what you've already done, and tell us what you know... perldoc -f keys perldoc -f sort /\/\ark -Original Message- From: Rajendra Babu, Praveen [mailto:[EMAIL PROTECTED]] Sent: Monday, December 30, 2002 3:16 P

RE: Reg ex help!

2002-12-19 Thread Mark Anderson
Is it always at the very end of the string? If not, then are there any other numbers enclosed in parens in the course names? Probably the following should work: $course =~ s/( \(\d+\)$//; # removes a space followed by an '(' followed by 1 or more digits, followed by ')' at the end of the string F

RE: stripping characters from a variable

2002-12-12 Thread Mark Anderson
> Hello. I have a logfile in which every message begins with a timestamp (ex. - 20012091500). I would like to be able to remove the last 4 characters (1500) off each of these to derive the date only (2001209). It works by chopping of each character individually, but I would like to know if there is

RE: multi line comments

2002-12-11 Thread Mark Anderson
perldoc perlpod -Original Message- From: Matt Simonsen [mailto:[EMAIL PROTECTED]] Sent: Wednesday, December 11, 2002 3:33 PM To: [EMAIL PROTECTED] Subject: multi line comments I believe there are no multi-line comments in Perl. Do any of you have a good hack to fake these? Thanks Matt

RE: Dynamic Array Names

2002-12-10 Thread Mark Anderson
> I have an array that I want to generate a new hash for each item that is > the first array. I want the new hashes to be named as the 1st array. Wow > I am confused reading that. Example ... Yes it is. > I am using Config::IniFiles I haven't used it, so I can't give you any module specific hel

RE: removing white space

2002-11-22 Thread Mark Anderson
>I tried to lookup the "perldoc -q" on the net but couldn't find anything? >(www.perldoc.com right?) perldoc is software that generally is installed with perl. perldoc.com has the same information, but doesn't have a way to use the flags that the software version has. The -q flag to perldoc sear

RE: how can I grab the first line from a text file

2002-11-20 Thread Mark Anderson
First open the file using open: perldoc -f open Then use the filehandle (FILE for instance) to put the first line in $str: $str = ; Then if you don't want to do anything else with the file, close it: perldoc -f close -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] S

RE: Help on -w

2002-11-05 Thread Mark Anderson
The '-w' helps you debug your code by producing warnings. The code may work, but $a has not been initialized when it reaches the if statement, so it will always fail. Is that really 'perfect'? Why have the if block if you know it will never be executed? The easy, although prone to overuse, solu

RE: adding stuff to array

2002-10-22 Thread Mark Anderson
perldoc -f push -Original Message- From: Jakob Kofoed [mailto:kof@;mail.dk] Sent: Tuesday, October 22, 2002 2:30 PM To: [EMAIL PROTECTED] Subject: adding stuff to array Hi, Can you ad a value to an array? fx: @xx = aa bb cc but I would like to put in "ss" so my new array would look

RE: Missing Bracket

2002-10-22 Thread Mark Anderson
I would guess that you are missing a curly bracket '}' somewhere in your program, but the program doesn't realize it until the end. The only way to find it that I know of is to use good spacing in your program and walk through { by { looking to make sure that it's paired correctly.

RE: Tables

2002-10-22 Thread Mark Anderson
See bottom for my response... -Original Message- From: dan [mailto:dan@;abovenet.org] Sent: Monday, October 21, 2002 5:42 PM To: [EMAIL PROTECTED] Subject: Tables ok, this probably has an easy answer, but yet i can't think of it. i want to create a "table", not a table in html, otherwise

RE: sort a hash

2002-10-09 Thread Mark Anderson
see bottom... -Original Message- From: P lerenard [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 09, 2002 1:21 PM To: [EMAIL PROTECTED] Subject: sort a hash Hi, @array = qx{egrep -n '\{' file); foreach $el (@array) { ($num,@other} = split(/\:/,$el); $thenum{$num} = $num; } foreac

RE: autoincrement and autodecrement

2002-10-08 Thread Mark Anderson
"Can someone help me please?" Can you be more specific about what you don't understand? If $foo is a string of alpha characters and you use ++ you get a string with the last character incremented alphabetically. This does not work both ways, -- does not reverse the effect of ++ on strings.

RE: How to generate all possible combination from a list of number

2002-10-01 Thread Mark Anderson
This looks like homework, but I'll give you a (one of many, I'd guess) pseudocode solution: sub print_combos(str,list) { # note -- PSEUDOCODE if (empty(list)) { # if (str != "") # do you want the empty list as an output? print str; } else { x = pop list; #remove an element

RE: Printing A Hash of Hashes

2002-09-30 Thread Mark Anderson
> This is from Chapter 9, page 281 slighly >changed to reflect my values: > >for $table ( keys %tablename) { >print "Table Name: $table \n"; > >for $items ( keys %{ $tablename{$table} } ) { >print "\t$items=$tablename{$table}{$items}\n "; > >} > >print "\n"; That looks re

RE: another regx ...

2002-09-30 Thread Mark Anderson
-Original Question- D-2165033-10.TKB61a => D 2165033 10 and 4-2175587-08.TKB63a => 4 2175587 08 using (( $ref, $numt, $id, $ext ) = $PATH[ 7 ] ) =~ /\w-(\d{7})-(\d{2}).[\w+|\d+]/; What am I doing wring? -My Response- Your parens are in the wrong place. You aren't capt

RE: "Or" Syntax

2002-09-26 Thread Mark Anderson
> > I am reading this file and have assigned the array[2] as $partition. > > sk5719::Is Automatic ARP supported on Linux > platforms?::Public::03-JUL-01 > sk14508::The last date to order VPN-1/FireWall-1 CP2000 is December > 31,2002.::Public::23-SEP-02 > skI4680::Which files to

RE: "Or" Syntax

2002-09-26 Thread Mark Anderson
If you are comparing numbers, you want to use == (strings use eq). You probably also only want to have one set of parens: if ($a == $b || $a == $c || $a == $d) {print "here"} or you could clarify further: if (($a == $b) || ($a == $c) || ($a == $d)) {print "here"} You should put the following lin

RE: need some parsing ideas )

2002-09-26 Thread Mark Anderson
Unless you are sure that the threads won't be running around midnight, you should take the date into account as well. /\/\ark -Original Message- From: Yacketta, Ronald [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 26, 2002 10:08 AM To: '[EMAIL PROTECTED]' S

RE: Regular Expression help

2002-09-24 Thread Mark Anderson
see my comments at bottom... -Original Message- From: Shaun Bramley [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 24, 2002 4:39 PM To: [EMAIL PROTECTED] Subject: Regular Expression help Hi all. I am hoping that someone can help me determine what is wronf with my regualr expressio

RE: Regular Expressions: Grouping and backreferences...

2002-09-10 Thread Mark Anderson
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 10, 2002 12:32 AM To: Beginners Perl Mailing List Subject: Regular Expressions: Grouping and backreferences... Hello, All: How can I capture all the words that contain 'at' in the string 'A fa

RE: need help extracting words from a string - Thanks and need more help

2002-08-20 Thread Mark Anderson
I would point you to perldoc -f exists perldoc -f defined and you will end up with either if (exists $hashname{$variable}) if (defined $hashname{$variable}) depending on your definition of 'set'. Notice the {} around the variable instead of []. /\/\ark -Original Message--

RE: need help extracting words from a string

2002-08-20 Thread Mark Anderson
bottom posted... -Original Message- From: Jessica [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 20, 2002 9:23 AM To: [EMAIL PROTECTED] Subject: need help extracting words from a string I am such a knuckle head... I read the lists. I stumble through books and still I cant figure out

RE: another reg needed

2002-08-16 Thread Mark Anderson
Do you want them in two separate variables, or in a list? Are you looking for just this one case, or a more general case? /\/\ark -Original Message- From: Jerry Preston [mailto:[EMAIL PROTECTED]] Sent: Friday, August 16, 2002 1:19 PM To: Beginners Perl Su

RE: Perl from command line documentation

2002-08-13 Thread Mark Anderson
perldoc perlrun -Original Message- From: Mario [mailto:[EMAIL PROTECTED]] Sent: Tuesday, August 13, 2002 5:09 PM To: [EMAIL PROTECTED] Subject: Perl from command line documentation Hi all! I'm triying to replace my awk habits with perl, but I wonder if there is any place where I can f

RE: deprewhat?

2002-08-12 Thread Mark Anderson
'deprecated' means that in the future, this functionality is expected to be removed from the programming language. It generally implies that you should do what you are doing in a different way so that in the future your code will still work. In this case, it looks like you are trying to assign th

RE: getting rid of box

2002-08-02 Thread Mark Anderson
How are you creating the report? If you are using some sort of print statement, what does it look like? Where is the data coming from? The boxes are non-printing characters of some sort. If you know that you are only going to use a small set of printable characters, you could probably create a

RE: more regex woes...

2002-07-31 Thread Mark Anderson
Looks to me like you understand it better than I did. I don't understand your question. /\/\ark -Original Message- From: Joe Sprankle [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 31, 2002 10:44 AM To: [EMAIL PROTECTED] Subject: more regex woes... Hi all, I

RE: regex question

2002-07-26 Thread Mark Anderson
-Original Message- From: Steve [mailto:[EMAIL PROTECTED]] Sent: Friday, July 26, 2002 5:21 PM To: Mark Anderson Cc: Beginners@Perl. Org Subject: Re: regex question >From what I have read from The Camel $1 should contain the matched text. >From that matched text I want to then

RE: Greedy Regular Expression

2002-07-26 Thread Mark Anderson
I'll try to answer one of your questions... >I'm having some trouble trying to easily remove lines from a data file using >a regular expression. I can do it by reading the file in >a line at a time then deciding whether to chuck it or write it out. My data >looks something like this - [Data remo

RE: regex question

2002-07-26 Thread Mark Anderson
$1 is a special variable. What are you actually trying to do here? What do you want to have print? [I've copied you, but please respond to the list.] /\/\ark -Original Message- From: Steve [mailto:[EMAIL PROTECTED]] Sent: Friday, July 26, 2002 4:20 PM T

RE: How well does Perl support FTPing?

2002-07-26 Thread Mark Anderson
-Original Message- From: Rupert Heesom [mailto:[EMAIL PROTECTED]] Sent: Friday, July 26, 2002 3:42 AM To: [EMAIL PROTECTED] Subject: How well does Perl support FTPing? Hi: [Does Perl support FTPing with resume?] I'm involved in the development of an application which will have modules

RE: A basic question about arrays

2002-07-26 Thread Mark Anderson
-Original Message- From: Eric Preece [mailto:[EMAIL PROTECTED]] Sent: Friday, July 26, 2002 4:09 PM To: [EMAIL PROTECTED] Subject: A basic question about arrays Hello, Yet another newbie question. I have a file, each line is a pipe delimited list (user name and password). I want to op

RE: Jes new to List

2002-07-25 Thread Mark Anderson
>I couldn't quite follow this program off the book. The parts not quite >clear to me are (the hwole program is given below): I'll go through them block by block, and then you can ask deeper questions about the ones that I don't explain well enough. >$i = 0; I'm guessing that you know that $i i

RE: another sort question (flame away)

2002-07-24 Thread Mark Anderson
>From: nkuipers [mailto:[EMAIL PROTECTED]] > >>Would trapping it an eval be what the doctor ordered? > >To answer my own question, no, it would not. > >#use warnings; > >would be better. It would probably be best to use no warnings; before the sort line in your script and use warnings; on the f

RE: Am I being stupid here... or?

2002-07-10 Thread Mark Anderson
== is a numerical operator eq is a string operator "something" == "notsomething" looks at the numerical value of each string, and they are the same so it returns true. "something" eq "notsomething" looks at the actual strings, which are different and returns false. for more information: perldoc

RE: chop off 1 white space?

2002-06-11 Thread Mark Anderson
> But, could someone explain the meaning of the "$" in the above expression, > s/\s$// . The $ looks for end of line/end of string. This is expression is saying take the whitespace character followed by end of line and replace it with nothing. If there is no whitespace character at the end of t

RE: help with pattern matching/parsing

2002-06-06 Thread Mark Anderson
Do you have multiple lines coming to STDIN? If so, then your $idNumber is probably getting blown away when the regex doesn't match later in the file. If you only want the first line of the file, then remove the while. If you have multiple lines that will match, you'll need a different structure,

lvalues

2002-06-06 Thread Mark Anderson
I came across a reference to lvalue(s) in perldoc -f substr I then searched perldoc for "lvalue", and looked at each reference in: perldoc perldiag perldoc perltoc perldoc perlfunc perldoc perlsub perldoc perlop perldoc perlguts perldoc perlsyn perldoc perlfaq7 perldo

RE: Help in Regular expression with array

2002-06-05 Thread Mark Anderson
Okay, with some experimenting, it looks like @lines is being looked at in a scalar way, therefore as the number of elements in the array, and that number doesn't contain the string "Date:". I would suggest: foreach(@lines) { if(/Date:/) { print "ok" } }

RE: Reverse sort?

2002-05-21 Thread Mark Anderson
My apologies, I miscopied the code, it should have been: foreach (reverse sort keys %myhash) { print "$_ : $myhash{$_}\n"; } -Original Message----- From: Mark Anderson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 21, 2002 11:38 AM To: [EMAIL PROTECTED] Subject: RE: Re

RE: Reverse sort?

2002-05-21 Thread Mark Anderson
More readable/maintainable is: @items = qw(a b c d e f g h i j k l m n o p q r s t u v w x y z); @sortedItems = reverse sort @items; #reverse sort the array print "@sortedItems"; Which gives the following as the answer: foreach reverse sort keys %myhash { print "$_ : $myhash{$_}\n"; }

RE: getopt::std

2002-05-21 Thread Mark Anderson
>>From: Bob Showalter >> From: Postman Pat >> >> Greetings, >> I am trying to do command line processing using the above >> lib, but am not >> quite getting the syntax from the PLEAC perl project. For >> instance I have >> the following args allowed: >> -s x.x.x.x | server.domain.com > serv

RE: Looping through variables

2002-05-17 Thread Mark Anderson
>I'm trying to loop through a list of variables and print their values. >e.g., print $name, $age, $phone. > >What's the best way to do this? I've tried > > foreach (qw(name age phone)) { > print ${$_}; > } > >but that doesn't seem to work. It works for me (using pe

RE: @array=

2002-05-03 Thread Mark Anderson
It's a matter of memory management. If you suck in an entire file, you could run out of memory, making your script run slower. Also, you have to do all of the reading before you can start processing the file. while () { if (/something/) { print "$_\n"; } } or while (my $i=) {

RE: Parameters

2002-05-02 Thread Mark Anderson
If you just want to pass a limited number of parameters, in a specified order, where they will always be there, it's easiest. They are then stored in the array @ARGV. script.pl filename.txt has the string filename.txt in $ARGV[0] If you want to use flags and optional parameters and such then r

RE: Help Please

2002-04-30 Thread Mark Anderson
This code will read the entire file into the array. This works fine for SMALL files. When you get into large files, the program will take up more RAM than the file takes on disk. You also probably won't eliminate your loops. They may no longer be while loops, but you will likely still need to

RE: CPAN?

2002-04-25 Thread Mark Anderson
>Is File::Find a standard module? (It is a module, right?) I don't know >anything really about modules except that they exist. Is this method >better than using opendir/readdir/closedir? > >And back to the original question, is CPAN good for questions like this? >What do people usually use it f

RE: Incrementing the letters in an array

2002-04-18 Thread Mark Anderson
>>> No, you need ++ vs +1. As they say in perl, ++ is magical and will >>> do want you want. + 1 will not. >>> >>> Wags ;) ps -- is not magical in the same sense as ++ either. >> >> How would you decrement a character then? There surely has to be a >> way? > >perldoc -f ord >perldoc -f chr >

RE: Incrementing the letters in an array

2002-04-18 Thread Mark Anderson
/\/\ark -Original Message- From: Allison Ogle [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 18, 2002 11:05 AM To: Mark Anderson Subject: RE: Incrementing the letters in an array If you're suggesting trying $code[$y]=$code[$y]++; it brings me one step closer in that

RE: Character Types

2002-04-17 Thread Mark Anderson
Those are likely non-printable characters in whatever font you are using. Use substr and ord to get the octal value and then split on it. Double check to make sure they are all the same character. /\/\ark -Original Message- From: Scott Lutz [mailto:[EMAI

RE: Perl simple array

2002-04-17 Thread Mark Anderson
perldoc -f split Your split statement is attempting to split $_, not @data. -Original Message- From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 17, 2002 6:54 PM To: [EMAIL PROTECTED] Subject: Perl simple array Hey All, Just wondering why the following code wo

RE: Strip $ from variable

2002-04-15 Thread Mark Anderson
You need to escape the $ in the regex: $string =~ s/\$//; -Original Message- From: Daniel Falkenberg [mailto:[EMAIL PROTECTED]] Sent: Monday, April 15, 2002 5:16 PM To: [EMAIL PROTECTED] Subject: Strip $ from variable Hello All, I was just wondering how I would go about stripping the $

RE: Split input on whitespace

2002-04-04 Thread Mark Anderson
No, you are printing to OUTFILE, which directs the output to "ex92.out". /\/\ark -Original Message- From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 3:00 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject

RE: Split input on whitespace

2002-04-04 Thread Mark Anderson
The only thing that you are sending to STDOUT is a "\n" for each line of your STDIN. /\/\ark Please don't cross-post. -Original Message- From: Bruce Ambraal [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 04, 2002 2:43 PM To: [EMAIL PROTECTED]; [EMAIL PR

RE: Hash Values (again)

2002-04-04 Thread Mark Anderson
Hope this helps. I made a lot of changes, and I didn't comment them all. I'm not sure where/how you sent this to the list, but I'm responding back to the beginners list. Don't crosspost between lists if you can help it. /\/\ark # warnings and strict help you

RE: Reading lines from a file

2002-04-03 Thread Mark Anderson
on the same line, others will be separated by a . I want to be able to bring in each line into the correct part of the HTML. -Original Message- From: Mark Anderson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 4:22 PM To: Glenn Cannon; [EMAIL PROTECTED] Subject: RE: Reading

RE: Reading lines from a file

2002-04-03 Thread Mark Anderson
Specific by line number? specific by text in the line? specific as line-by-line? Please be more specific. :) To read line $x of FILE into $line: foreach 2..$x; $line = reads in the next line of the file. Hope this helps, /\/\ark -Ori

RE: Printing the number of times phone number appear in a textfile

2002-03-22 Thread Mark Anderson
First of all, you are only matching a single digit. You want to change your regular expression from /(\d)/ to /(\d+)/, which matches one or more digits, and slurps up as many as it finds in a row. One issue you will have is that a file containing addresses, you are also going to get a count on a

RE: searching a large file

2002-02-28 Thread Mark Anderson
I would suggest using something like the following, where INFILE is the filehandle of your textfile: my $NewLine = ""; my $TheLine = ""; #read in 500 characters from INFILE until INFILE is exhausted while (read(INFILE,$NewLine,500)) { # concat $NewLine to the end of the existing $TheLine

RE: How to print firstly Raport page ,and after data from input file

2002-02-28 Thread Mark Anderson
I'll help what I can. You need to store the input and not print it out until after you've printed out your raport. I'm not sure what you are doing, so I haven't tried to fix anything except the printing of the report. If this code is going to be in use for a while, it would be good for you to ad

  1   2   >