UTF8 Issue?

2014-03-01 Thread Christopher Stone
Hey Folks, When run as a BBEdit text-filter the script works fine with the ascii line, but it produces goop for the utf8 characters. Obviously I'm doing something wrong and need an assist. Thank you. -- Best Regards, Chris -- #! /usr/bin/env perl use

Re: A question about backreference

2005-03-11 Thread Stone
Suppose there is a string var = 123, I want to substitute 123 by 456, then I have to write like this s/(var\s+=)\s+\d+/\1 123/. Is there a way so that I can combine ' ' into the parenthesis as s/(var\s+=\s+)\d+/\1456? I know \1456 is not correct, but how can I seperate \1 and 456 without

Re: regular expression help

2005-03-11 Thread Stone
I hope I don't have any bugs here :) Just one. :) Your expressions all say \d instead of \d? for the second digit in each set, while the simple one correctly has \d?. So your expressions had an unfair advantage and as a result finish faster. Add \d? to your expressions, and you should find

Re: searching and replacing

2005-03-11 Thread Stone
if (/([0-9.]{6}) set/) { s/$1 set/\n-50.2 v \n$1 set/; You need to escape the period or it will match any character but newline. As it is right now you'll match .FANTA, which isn't what you want. Why does this syntax not work? The $1 does not come out. You

Re: regexp help

2005-03-11 Thread Stone
if( $string = /([\d]+)-([\d]+)-([\d]+)\s([\d\d):(\d\d):(\w+)/ ) { print(Hour:Minute = $4:$5\n); } You have an unmatched [ in your expression. (\w+) doesn't match the . if that matters to you. This is breaking. If anyone can refine this, that would be great. thanks, radhika --

Re: regular expression help

2005-03-10 Thread Stone
yes, and for complexity: $field =~ /^([1-9]\d?)\.{2}\1$/; I know you said that's untested, but I don't think it's correct. You're saying: 1. ^ - Start 2. ([1-9]\d?) -Any character 1-9 followed by zero or one digit characters. 3. \.{2} - Two periods. 4. \1 - The same sequence of

Re: regular expression help

2005-03-10 Thread Stone
$field =~ /^(?:([1-9]\d?)\.){2}\1$/; That won't work either. When you say ([1-9]\d?) you're telling it (If there is a match) capture the stuff in parentheses and store it. When you say \1 you're telling the script you know that first batch of stuff you captured? Well I want that here. But

Re: dynamically calling a subroutine

2005-01-18 Thread Stone
On Tue, 18 Jan 2005 20:05:01 +0200, Absolut Newbie [EMAIL PROTECTED] wrote: $var1(); # this is where it crashes You're looking for the eval command, which will read a string and evaluate the code it contains. ie: eval ( $var1() ); On on the other hand, you could do this with if statements.

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 =~

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).

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] http://learn.perl.org/ http://learn.perl.org/first-response

RE: Could anyone please answer a simple PERL question.

2004-07-08 Thread Carol Stone
Just for this thread, I have gone to ActiveState and learned how to use their search facility to find my email address to copy and update my response to someone way back on August 31, 2000 - this was my very first perl success ;-D I have added a note regarding Windows XP at the end of it. You're

Binary File Pattern Matching

2002-06-24 Thread Andrew Stone
Hello all, I'm having a problem with (I suppose) pattern matching. Here's the task: To take binary data from windows(little-endian) and convert to Unix(big-endian). If the file is all numeric, I don't have a problem, but it isn't. I need to be able to recognize that one of the four bytes is

RE: Binary File Pattern Matching

2002-06-24 Thread Andrew Stone
Sorry about that...forgot to reply to all. Working with 4 languages at once tends to turn my brain to mush. -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED]] Sent: Monday, June 24, 2002 2:41 PM To: 'Andrew Stone' Subject: RE: Binary File Pattern Matching Send

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread Carol Stone
Southbury, CT and I *just* used Perl at work for the first time last night. -carol stone -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread Carol Stone
-Original Message- From: Brett W. McCoy [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 2:53 PM To: Carol Stone Cc: [EMAIL PROTECTED] Subject: RE: Off-Topic (200%) - Where are you from? On Fri, 9 Nov 2001, Carol Stone wrote: Southbury, CT and I *just

RE: Off-Topic (200%) - Where are you from?

2001-11-09 Thread Carol Stone
-Original Message- From: Johnson, Shaunn [mailto:[EMAIL PROTECTED]] Sent: Friday, November 09, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: RE: Off-Topic (200%) - Where are you from? --*heh* you rule, carol stone. --i'm still lurking and learning. i have a LONG way to go