CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [reld] Possibly a variable scope problem ...: Edit Log



reld
Novice

May 29, 2013, 3:28 AM


Views: 626
Re: [reld] Possibly a variable scope problem ...

As another example, using the same code. If I add:


Code
while( my $line = $file_handle3->getline() ) { 


my @cut = split ( /,/, $line );

my $name = $cut[0];


while ( my $line2 = $file_handle1->getline() ) {

if ( $line2 =~ /$name/ ) { # does not work

$file_handle2->print($line2);
}
}
}


The $name in the if ( $line2 =~ ) does not seem to contain a value. If I use a literal string instead the code works, so I know it has something to do with the $name variable.


(This post was edited by reld on May 29, 2013, 3:30 AM)


Edit Log:
Post edited by reld (Novice) on May 29, 2013, 3:30 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives