RE: Replacing carriage returns in a variable

2001-10-02 Thread Guy Tubbs
Thanks for your replies. It does insert another character, but keeps the return too. I have tried: $text =~ s/\n//g; and $text =~ s/\r//g; but it does the same thing, i.e. I get: Line1 Line2 What I need is: Line1Line2 Do you know how to get rid of the returns altogether? Guy -- T

$variable manipulation question

2001-10-02 Thread Shannon Murdoch
Hi all, I'm trying to get a string (held in a variable) to have all it's characters spaced apart by a ' ' space. ie. $input's content changes from '1234' to '1 2 3 4' Is there some way to do this? cheers, -Shannon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mai

Re: $variable manipulation question

2001-10-02 Thread Shannon Murdoch
I found a solution not long after using a loop of sorts. (and killed two birds with one stone, as my next step was to put each item (space delimited) into an array). I made a loop saying, 'as long as $input still has characters in it, put each one (one at a time) into the @front_chars array, then

Re: formating variables again...

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Wagner Garcia Campagner) wrote: > Is there a way for me to format $var to became 34,56 instead of 34.56 ??? change the decimal point to a comma. $var =~ s/\./,/; -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - h

Re: $variable manipulation question

2001-10-02 Thread Rajeev Rumale
Thats Great ! Yes this is infact helped me. I was trying it in a much complicated way. regards Rajeev Rumale - Original Message - From: "Shannon Murdoch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 6:50 PM Subject: Re: $variable manipulation question

Re: $variable manipulation question

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Shannon Murdoch) wrote: > I'm trying to get a string (held in a variable) to have all it's characters > spaced apart by a ' ' space. > > ie. $input's content changes from '1234' to '1 2 3 4' $x = join ' ', split //, $x; -- brian d foy <[EMA

Re: Replacing carriage returns in a variable

2001-10-02 Thread Roger C Haslock
Note: this code only replaces carriage returns, not line feeds. Remember an ancient typewriter. The carriage return returns the carriage to the beginning of the line, but does not advance to the next line. This enables the typist to overstrike, underline, or embolden characters. The linefeed adva

Re: $variable manipulation question

2001-10-02 Thread Shannon Murdoch
Great to hear Rajeev! Jan-willem wrote this regarding the problem: > Hi Shannon, > > This is a way to space apart the variable. > > $input = "345678"; > @pieces = split(//,$input); > > foreach $line (@pieces) { > $newinput = $newinput . " $line"; > } > > I'm sure it is also possible with a fa

Re: $variable manipulation question

2001-10-02 Thread Shannon Murdoch
> $x = join ' ', split //, $x; That looks like a very compact way of doing it, Brian- is it possible to get a bit of a rundown of how it works? cheers, -Shannon > From: [EMAIL PROTECTED] (_brian_d_foy) > Newsgroups: perl.beginners.cgi > Date: Tue, 02 Oct 2001 06:56:59 -0400 > To: [EMAIL PROTEC

RE: Replacing carriage returns in a variable

2001-10-02 Thread Brett W. McCoy
On Tue, 2 Oct 2001, Guy Tubbs wrote: > but it does the same thing, i.e. I get: > > Line1 > Line2 > > What I need is: > > Line1Line2 > > Do you know how to get rid of the returns altogether? Odd. Here's the code snippet I ran right at the command-line: $ perl $text = "line1\nline2\n"; $te

Re: $variable manipulation question

2001-10-02 Thread fliptop
Shannon Murdoch wrote: > > > $x = join ' ', split //, $x; > > That looks like a very compact way of doing it, Brian- is it possible to get > a bit of a rundown of how it works? perldoc -f join perldoc -f split -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAI

RE: formating variables again...

2001-10-02 Thread Bob Showalter
> -Original Message- > From: Wagner Garcia Campagner [mailto:[EMAIL PROTECTED]] > Sent: Monday, October 01, 2001 5:13 AM > To: [EMAIL PROTECTED] > Subject: formating variables again... > > > Hi, > > I have a variable $var = 34.5678 > > If I > > printf ("%.2f", $var); > > Then $var =

Re: $variable manipulation question

2001-10-02 Thread Roger C Haslock
If you are sure its a string, maybe you can use 'unpack', and then 'join'. - Roger - - Original Message - From: "Shannon Murdoch" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 11:20 AM Subject: $variable manipulation question > Hi all, > > I'm trying to ge

RE: $variable manipulation question

2001-10-02 Thread Bob Showalter
> -Original Message- > From: Shannon Murdoch [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 02, 2001 6:51 AM > To: [EMAIL PROTECTED] > Subject: Re: $variable manipulation question > > > I found a solution not long after using a loop of sorts. (and > killed two > birds with one ston

Re: $variable manipulation question

2001-10-02 Thread Rajeev Rumale
Wow !, And I never thought we can use "split //" This solution print join ' ', split //, $input; shows the beauty of Perl :-) Rajeev - Original Message - From: "Bob Showalter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 02, 2001 9:06 PM Subject: RE: $vari

Re: suggestions?

2001-10-02 Thread Gareth Londt
hi i have a problem in which i have a lists of Domain names ..k, and i need to get there matching email address of an external site but i cant arite a shell script so i was wondering if anyone has any ideas or code that can help me with what im doing? also the script needs to run so that when

Re: $variable manipulation question

2001-10-02 Thread Shannon Murdoch
> How did that help you? Now you have an array of individual > characters, gotten the hard way. Originally I was aiming to space each character apart so I could use a space ' ' as the delimiting character when I brought them into an array (to be analyzed character by character by other following

Re: suggestions?

2001-10-02 Thread Brett W. McCoy
On Tue, 2 Oct 2001, Gareth Londt wrote: > i have a problem in which i have a lists of Domain names ..k, and i need to > get there matching email address of an external site but i cant arite a shell > script so i was wondering if anyone has any ideas or code that can help me > with what im doing?

Re: suggestions?

2001-10-02 Thread Bill Jones
>> i have a problem in which i have a lists of Domain names ..k, and i need to >> get there matching email address of an external site but i cant arite a shell >> script so i was wondering if anyone has any ideas or code that can help me >> with what im doing? > > Get what matching email addresse

Free CGI hosting?

2001-10-02 Thread RoadRaat
Are there free web-hosts or free Unix shell accounts with hosting that also provide CGI capability? Thanks, Nelson -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

frexp panic

2001-10-02 Thread Robert Becker
Has anyone ever gotten this error from perl? How do I resolve it? panic: frexp at IWfacschd.cgi.exp line 366. line 366: $fte = sprintf("%2.4f", $fte); $fte is a returned number from a database. frexp is apparently a library that allows the printf('%f') to work but has failed. AtDhV

Re: frexp panic

2001-10-02 Thread Brett W. McCoy
On Tue, 2 Oct 2001, Robert Becker wrote: > Has anyone ever gotten this error from perl? How do I resolve it? > > panic: frexp at IWfacschd.cgi.exp line 366. > > line 366: $fte = sprintf("%2.4f", $fte); > $fte is a returned number from a database. > > frexp is apparently a library that

e-mailing an attachment with Perl

2001-10-02 Thread Stokes, John
Hey everybody, I've got a PostFix mail server set up that's working fine. However, in some cases we want to generate output files and attach them to an e-mail instead of just dumping the HTML data in text form into an e-mail. Anybody know how I can do that? Thanks in advance. -John M. Stokes Co

RE: e-mailing an attachment with Perl

2001-10-02 Thread Bob Showalter
> -Original Message- > From: Stokes, John [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, October 02, 2001 2:13 PM > To: '[EMAIL PROTECTED]' > Subject: e-mailing an attachment with Perl > > > Hey everybody, > > I've got a PostFix mail server set up that's working fine. > However, in some >

Re: $variable manipulation question

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Shannon Murdoch) wrote: > > $x = join ' ', split //, $x; > > That looks like a very compact way of doing it, Brian- is it possible to get > a bit of a rundown of how it works? start from the right and work your way left. ;) -- brian d foy <[E

Re: $variable manipulation question

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Shannon Murdoch) wrote: > Brian's *ahem* - brian. > print join ' ', split //, $input; > > doesn't actually change $input's content however. if that is what you wanted then you just need to fill in the details: $input = join ' ',

Re: suggestions?

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Bill Jones) wrote: > RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon[OR] you're generous. i just F them outright. -- brian d foy <[EMAIL PROTECTED]> - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubl

Killing multiple ' ' spaces from a string/$variable

2001-10-02 Thread Shannon Murdoch
Hi all, I'm trying to get this string (example): $all_codes = '4c1 4- 4c2 4-8b1 8g1'; in to an array (@codes), using it's whitespace as the delimiter. ie. @codes = split(/ /,$all_codes); but I keep getting extra whitespace elements picked up into the array...: '4c1,4-,4c2,4-, ,8b1,8g1'

Re: Killing multiple ' ' spaces from a string/$variable

2001-10-02 Thread Kevin Meltzer
Hi Shannon, Very close. You are allowed to use a pattern in a split. my @codes = split(/\s+/,$all_codes); Should give you what you want. This will split the string on 1 or more spaces. Look at 'perldoc -f split' for more information. Cheers, Kevin On Wed, Oct 03, 2001 at 09:47:11AM +1000, Sha

Re: Killing multiple ' ' spaces from a string/$variable

2001-10-02 Thread Shannon Murdoch
I see now! Worked like a charm. While we're on the topic of deletion/exclusion of string elements when brought in to an array, how do I kill '\n' line breaks from the string (or even just exclude them at array input time)? ie. 'hello how are you /n I am fine' becomes (hello,how,are,you,I,am,f

Re: Replacing carriage returns in a variable

2001-10-02 Thread Alex Chau
Try this if you're using linux/unix system: $variable =~ s/\n\r//g; Alex Guy Tubbs wrote: >Hi, > >Can anyone give me the code that will replace all the carriage returns in a >variable with another character. > >I am getting input from a web page and need to replace the returns with the > tag.

Re: Killing multiple ' ' spaces from a string/$variable

2001-10-02 Thread _brian_d_foy
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Shannon Murdoch) wrote: > > From: [EMAIL PROTECTED] (Kevin Meltzer) > > my @codes = split(/\s+/,$all_codes); > Worked like a charm. While we're on the topic of deletion/exclusion of > string elements when brought in to an array, how do I kill

Re: $variable manipulation question

2001-10-02 Thread Randal L. Schwartz
> "Shannon" == Shannon Murdoch <[EMAIL PROTECTED]> writes: Shannon> I'm trying to get a string (held in a variable) to have all Shannon> it's characters spaced apart by a ' ' space. Shannon> ie. $input's content changes from '1234' to '1 2 3 4' Shannon> Is there some way to do this? Ther