Re: formating variables again...
I would have done it like this. $var = 34.5678; $var=~/((\d+).(\d{0,2}))/; $var = $1; $var=~s/\./,/sg; printf ( The formated value is : $var); ---OUTPUT The formated value is : 34.56 Well there may be better and more straigth forward ways, I was just trying to get used to Patterns and subsititution. with regards Rajeev Rumale - Original Message - From: Wagner Garcia Campagner [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 01, 2001 9:18 PM Subject: formating variables again... Hi, I have a variable $var = 34.5678 If I printf (%.2f, $var); Then $var = 34.56 Is there a way for me to format $var to became 34,56 instead of 34.56 ??? Thanks, Wagner. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Stylesheet line not working
Yeup ! The the TYPE declaration is very important !. We tend to ignore such things when we use MS platforms...:-( Thanks for correcting me Michael . with Regards Rajeev Rumale - Original Message - From: Michael D. Risser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, October 01, 2001 9:17 PM Subject: Re: Stylesheet line not working On Monday 01 October 2001 05:26 am, Rajeev Rumale wrote: Check out the path and location. As per you current code the location of stylesheet should in the directory where the script is lies. As gernally all scripts are in cgi-bin which might have only execute permission. its better to have the style sheet into a seprate directory in website root(say styles). Then you can write link rel=stylesheet href=/styles/style1.css this should work perfectly. Rajeev Rumale - Original Message - From: Brett W. McCoy [EMAIL PROTECTED] To: Gary L. Armstrong [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Monday, October 01, 2001 3:42 AM Subject: Re: Stylesheet line not working On Sun, 30 Sep 2001, Gary L. Armstrong wrote: I have skimmed through the Llama and Camel and I don't know why this should not work: #startcode print BLOCK1; !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/transitional.dtd; html head titleGeek Shop -- A Web Page/title link rel=stylesheet href=style1.css /head ...blahblahblah... BLOCK1 #endcode Actually the whole thing works fine (hooray, my first CGI) except that it's not finding my style1.css, and before I start messing around with it too much, I thought I'd find out if any of you might throw me a bone. Where is the style1.css file? Going by the above code, it should be in the document root of the web server, not in the cgi-bin directory. In the HTML that is output, its context is still that of the web server, not the CGI script. -- Brett http://www.chapelperilous.net/ It's not hard to admit errors that are [only] cosmetically wrong. -- J.K. Galbraith -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] I have found that some browsers do not like the style tag in the form you are sending they prefer LINK REL='stylesheet' TYPE='text/css' href='path/to/css' For some reason they require the TYPE attribute to be present. -- Michael D. Risser Software Engineer = Machine Vision Products, Inc. www.visionpro.com [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Replacing carriage returns in a variable
Thanks for your replies. It does insert another character, but keeps the return too. I have tried: $text =~ s/\n/br/g; and $text =~ s/\r/br/g; but it does the same thing, i.e. I get: Line1br Line2 What I need is: Line1brLine2 Do you know how to get rid of the returns altogether? Guy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
$variable manipulation question
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-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 reverse the list order so it's normal again.' $input = 1234; while($input ne undef){ push(@front_chars,chop($input)); } @front_chars = reverse @front_chars; Not sure if this is helpful to anyone, but it helped me 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-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 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 reverse the list order so it's normal again.' $input = 1234; while($input ne undef){ push(@front_chars,chop($input)); } @front_chars = reverse @front_chars; Not sure if this is helpful to anyone, but it helped me 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-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Replacing carriage returns in a variable
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 advances to the next line, and used without a carriage return, enabled e.e.cummings to write his non-stop paragraphing. - Roger - - Original Message - From: Guy Tubbs [EMAIL PROTECTED] To: Roger C Haslock [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, October 02, 2001 9:52 AM Subject: RE: Replacing carriage returns in a variable Thanks for your replies. It does insert another character, but keeps the return too. I have tried: $text =~ s/\n/br/g; and $text =~ s/\r/br/g; but it does the same thing, i.e. I get: Line1br Line2 What I need is: Line1brLine2 Do you know how to get rid of the returns altogether? Guy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
$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 PROTECTED] Subject: Re: $variable manipulation question 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 [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Replacing carriage returns in a variable
On Tue, 2 Oct 2001, Guy Tubbs wrote: but it does the same thing, i.e. I get: Line1br Line2 What I need is: Line1brLine2 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; $text =~ s/\n/br/g; print $text; ^d line1brline2br$ -- Brett http://www.chapelperilous.net/ Tomorrow will be cancelled due to lack of interest. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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: [EMAIL PROTECTED]
RE: formating variables again...
-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 = 34.56 Is there a way for me to format $var to became 34,56 instead of 34.56 ??? perldoc perllocale -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 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-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: $variable manipulation question
-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 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 reverse the list order so it's normal again.' $input = 1234; while($input ne undef){ push(@front_chars,chop($input)); } @front_chars = reverse @front_chars; Not sure if this is helpful to anyone, but it helped me How did that help you? Now you have an array of individual characters, gotten the hard way. Using split() is the way to do this (see perldoc -f split): @chars = split //, $input; To print this list out with spaces between, you can: $ = ' '; # this is the default print @chars; # double quotes required here or print join ' ', @chars; The split and join can be combined to elminate the intermediate array: print join ' ', split //, $input; Which was brian's solution. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suggestions?
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 different domains come in it will fetch those aswell and all the email addresses needs to be stored in a .txt file with its matching Domain. i have tried a lynx dump but this is not going to work as the shell script is going to be hectic with all the regualr expression. Any ideas? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 routines). ie. $input = '12345' - $input = '1 2 3 4 5' so I could use: @chars = split(/ /,$input); to get the individual characters into their own array items. Your: @chars = split //, $input; Does this all in one bang which is great! Thanks! Brian's print join ' ', split //, $input; doesn't actually change $input's content however. From: [EMAIL PROTECTED] (Bob Showalter) Newsgroups: perl.beginners.cgi Date: Tue, 2 Oct 2001 09:06:01 -0400 To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: RE: $variable manipulation question -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 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 reverse the list order so it's normal again.' $input = 1234; while($input ne undef){ push(@front_chars,chop($input)); } @front_chars = reverse @front_chars; Not sure if this is helpful to anyone, but it helped me How did that help you? Now you have an array of individual characters, gotten the hard way. Using split() is the way to do this (see perldoc -f split): @chars = split //, $input; To print this list out with spaces between, you can: $ = ' '; # this is the default print @chars; # double quotes required here or print join ' ', @chars; The split and join can be combined to elminate the intermediate array: print join ' ', split //, $input; Which was brian's solution. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suggestions?
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? Get what matching email addresses? Are you harvesting email addresses off of websites? -- Brett http://www.chapelperilous.net/ He who is content with his lot probably has a lot. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: suggestions?
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 addresses? Are you harvesting email addresses off of websites? If so, please scan http://insecurity.org - I want to add your finger-print to my server so I can block them. Thx! -Sx- :] PS - In case anyone was wondering, you *could* add this to your Apache httpd config: IfModule mod_rewrite.c RewriteEngine on RewriteLog /var/log/mod_rewrite.log RewriteLogLevel 0 # Check for moved URLs... # RewriteCond %{REQUEST_FILENAME} /(.+)?$ [OR] RewriteCond %{REQUEST_FILENAME} /perl(.+)?$ [NC,OR] RewriteCond %{REQUEST_FILENAME} /ora/(.+)?$ [NC,OR] RewriteCond %{REQUEST_FILENAME} /sneex(.+)?$ RewriteRule ^.*$ http://insecurity.org/410.shtml [L] # RewriteRule ^.*$ http://insecurity.org/sneex/Perl_v2/ [R,L] # Check for Code Red non-sense... RewriteCond %{REQUEST_FILENAME} \.ida?.+$ [NC] RewriteRule ^.*$ http://insecurity.org/403.shtml [L] # RewriteRule ^.*$ http://insecurity.org/notwindows.html [L] # Check for RewriteCond %{REQUEST_FILENAME} \.(exe|com)$ [NC] RewriteRule ^.*$ http://insecurity.org/403.shtml [L] # RewriteRule ^.*$ http://insecurity.org/notwindows.html [L] # Sx: research further... # RewriteCond %{HTTP_USER_AGENT} ^[Ll]ynx[OR] # [empty] Email Magnet # [empty] eMailReaper RewriteCond %{REQUEST_FILENAME} \.+?$ RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon[OR] RewriteCond %{HTTP_USER_AGENT} ^[Ee]mailWolf [OR] RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR] RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*NEWT [OR] RewriteCond %{HTTP_USER_AGENT} ^Crescent [OR] RewriteCond %{HTTP_USER_AGENT} ^CherryPicker [OR] RewriteCond %{HTTP_USER_AGENT} ^WebWeasel [OR] RewriteCond %{HTTP_USER_AGENT} ^Web.*Mole [OR] RewriteCond %{HTTP_USER_AGENT} ^WebCollector [OR] RewriteCond %{HTTP_USER_AGENT} ^.*NEWT.*ActiveX[OR] RewriteCond %{HTTP_USER_AGENT} ^Slurp [OR] RewriteCond %{HTTP_USER_AGENT} ^.*[Bb]ot [OR] RewriteCond %{HTTP_USER_AGENT} ^Open[Ff]ind[OR] RewriteCond %{HTTP_USER_AGENT} ^Open[Bb]ot [OR] RewriteCond %{HTTP_USER_AGENT} ^[Ww]get[OR] RewriteCond %{HTTP_USER_AGENT} ^[Ll][Ww][Pp] [OR] RewriteCond %{HTTP_USER_AGENT} ^[Bb]ench[Mm]ark[OR] RewriteCond %{HTTP_USER_AGENT} ^[Pp]erl[OR] RewriteCond %{HTTP_USER_AGENT} ^[Ww]eb[Bb]andit[OR] RewriteCond %{HTTP_USER_AGENT} ^WebEMailExtrac.* [OR] RewriteCond %{HTTP_USER_AGENT} ^NICErsPRO [OR] RewriteCond %{HTTP_USER_AGENT} ^Telesoft [OR] RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR] RewriteCond %{HTTP_USER_AGENT} ^Microsoft.URL [OR] RewriteCond %{HTTP_USER_AGENT} ^Mozilla/3.Mozilla/2.01 [OR] RewriteCond %{HTTP_USER_AGENT} ^EmailCollector RewriteRule ^.*$ http://insecurity.org/403.shtml [L] # RewriteRule ^.*$ http://insecurity.org/nospam.html [L] # Include /usr/local/apache/nospam.conf /IfModule -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Free CGI hosting?
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
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. AtDhVaAnNkCsE Robert Becker Programmer/Analyst Carroll College Waukesha, Wisconsin [EMAIL PROTECTED] (262) 524-7682 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: frexp panic
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 allows the printf('%f') to work but has failed. For testing purposes, what happens when you hard code the number into the expression? -- Brett http://www.chapelperilous.net/ This PORCUPINE knows his ZIPCODE ... And he has VISA!! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
e-mailing an attachment with Perl
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 Computer Psychiatrist (Director of Information Technology) Church Resource Ministries [EMAIL PROTECTED] Three Pillars: Humility, Communication, Balance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: e-mailing an attachment with Perl
-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 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? I've used Mime::Lite successfully for this kind of thing. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: $variable manipulation question
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 ' ', split //, $input; -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Killing multiple ' ' spaces from a string/$variable
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' which is not good for the rest of the program. I can't seem to get tr/// or s/// to work on it (the way I'm trying to use them). $all_codes =~ tr/' +'/ /; doesn't affect the string at all. Any ideas? cheers, -Shannon -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Killing multiple ' ' spaces from a string/$variable
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, Shannon Murdoch ([EMAIL PROTECTED]) said something similar to: 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); -- [Writing CGI Applications with Perl - http://perlcgi-book.com] Deserve it (death)! I daresay he does. Many that live deserve death. And some t hat die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the wise cannot see all end. -- Gandalf (Fellowship of the Ring) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Killing multiple ' ' spaces from a string/$variable
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,fine) when in the array. Thanks Kevin, you're a champ. From: [EMAIL PROTECTED] (Kevin Meltzer) Reply-To: [EMAIL PROTECTED] Newsgroups: perl.beginners.cgi Date: Tue, 2 Oct 2001 20:09:50 -0400 To: Shannon Murdoch [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Killing multiple ' ' spaces from a string/$variable 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, Shannon Murdoch ([EMAIL PROTECTED]) said something similar to: 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); -- [Writing CGI Applications with Perl - http://perlcgi-book.com] Deserve it (death)! I daresay he does. Many that live deserve death. And some t hat die deserve life. Can you give it to them? Then do not be too eager to deal out death in judgement. For even the wise cannot see all end. -- Gandalf (Fellowship of the Ring) -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Replacing carriage returns in a variable
Try this if you're using linux/unix system: $variable =~ s/\n\r/br/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 br tag. Thanks, Guy -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Killing multiple ' ' spaces from a string/$variable
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 '\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,fine) when in the array. since a newline is whitespace, Kevin's example still works. :) -- brian d foy [EMAIL PROTECTED] - Perl services for hire CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]