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, 07: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, 05:53 PM
KevinADC KevinADC is offline
Learning Programmer
 
Join Date: Jan 2007
Posts: 91
Rep Power: 7
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
Forum Jump

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


All times are GMT -5. The time now is 05:20 PM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 98%

Ads