Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
if($page eq "x1a.html") { $re_type = "a2"; $Q = ($prod) ? 'a0' : 'a0'; $send=$sec.$account.$year.$view; } if($page eq "x22.html") { $re_type = "x2"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view; } if ($page eq "y11.html") { $req_type = "y1"; $Q = ($prod) ? 'p0' : 'w0'; $send=$sec.$account.$year.$view.$action; } if ($send) { got_send(); } sub got_send { my $socket; my $x = ''; my @read = (); my $host = ($prod) ? 'my.prod.com' : 'mytest.box.com'; my $port; # Alternate depending on the time (in seconds) ($now[5] % 2) ? ($port = 6000) : ($port = 6100); $AoH{300} = sprintf "%2s(%d) %s", $QPro, ($port/100), $send; $socket = IO::Socket::INET->new( "$host:$port" ) or &error; print $socket "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <!DOCTYPE ACCOUNTS REF NAMES>\n <ACCOUNTS>\n <Type>$re_type<Type>\n <Id>$send</Id>\n <Profile>$Q</Profile> </ACCOUNTS>\n \n"; $x = <$socket>; close(Server); $x=~s/</\n</g; @read = split(/\n/, $x); foreach my $y (@read) { if (!$y) { $y = '<0>' } # Prevent uninitialzed message on $1 $y=~/<(.*?)>(.*)/; if($1 eq "7"){$name = $2;} #more code here.... last if ($x =~ /^[\s\x00]*$/); } } #End of sub
<1>66543 <2>2009 <3>TY <4>- <6> <7>TOM <8>2 - DUNDAS <8>100 - MAIN <9>ONT 00001 <10> <11>000-000-0000 <12>
<1>66543 <2>2009 <3>TY <4>- <6> <7>TOM <8>2 - DUNDAS <8>100 - MAIN <9>ONT 00001 <10> <11>000-000-0000 <12> <1>12345 <2>1999 <3>PP <4>XLX - TEST <6>Comm <7> <8>1 BLVD <9>MA 00001 <10>CITI, INC. <11>000-000-0000 <12> <1>8887 <2>2000 <3> <4>TEST <6> <7>JOE <7>MARY <8>100 MAIN <9>CT 02221 <10>BH, INC. <11>871-000-0000 <12>YEAR
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Combining calls to a subroutine issue.
by graff (Chancellor) on Apr 14, 2010 at 16:24 UTC | |
by Anonymous Monk on Apr 14, 2010 at 17:28 UTC | |
by graff (Chancellor) on Apr 15, 2010 at 03:45 UTC | |
by Anonymous Monk on Apr 15, 2010 at 15:50 UTC | |
by graff (Chancellor) on Apr 16, 2010 at 17:31 UTC |