Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > Perl

Perl Discussion for the PERL language - Practical Extraction and Reporting Language, is a programming language often used for creating CGI programs.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old 05-22-2008, 06:10 PM
John_L John_L is offline
Newbie
 
Join Date: May 2008
Posts: 10
Rep Power: 0
John_L is on a distinguished road
Default Re: Regex Expressions

alright, cool thanks. I'm also having problems concatenating strings from standard input. My subroutine is called that contains a string in $_[0], which I want to concatenate with input from <stdin>. "." or "join()" doesn't seem to work. Can "\n" - new line characters cause problems when reading from standard input?

Code:
while( $line = <stdin> )
{
   $_[0] = $_[0] . $line  #doesn't work
   $_[0] .= $line           #doesn't work
}
what's the best way to get this to work?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 05-23-2008, 04:53 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 89
Rep Power: 6
KevinADC is on a distinguished road
Default Re: Regex Expressions

yes, chomp() the input from stdin:

while ( chomp(my $line = <STDIN>)) {
$_[0] .= $line;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Tutorial: C# Regex NeedHelp CSharp Tutorials 2 05-01-2007 06:44 AM
regex (yuck) John PHP Forum 9 08-09-2006 12:35 AM
Boolean expressions Sionofdarkness Java Help 11 08-02-2006 07:25 PM
Arithmetic Expressions Sionofdarkness Java Help 2 07-29-2006 12:23 PM
Regular expressions Nightracer General Programming 6 07-24-2006 09:57 PM


All times are GMT -5. The time now is 04:00 PM.

Contest Stats

John ........ 223.00000
dargueta ........ 168.00000
Xav ........ 164.00000
gaylo565 ........ 18.00000
WingedPanther ........ 15.00000
|pH| ........ 15.00000
Johnnyboy ........ 3.00000
navghost ........ 1.00000

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 65%

Ads