http://www.perlmonks.org?node_id=1012382

puchku has asked for the wisdom of the Perl Monks concerning the following question:

i've been writing a vb 6.0 program and in it i need to have a text file created during runtime as follows:

dim fs,fname Set fs = New FileSystemObject Set fname = fs.CreateTextFile("D:\vb\perlprog.txt", True) fname.WriteLine ("#!/usr/bin/perl -w") fname.WriteLine ("use strict;") . . . fname.WriteLine ("my $t = Net::Telnet->new(Host => $ipad, PORT => '23' + , Timeout => 10 , Errmode => 'return');") . . .

in that vb program, i've taken data in a variable like this: IPAD = rec3("IPADDRESS")

i want to take this value(an ip address) from this variable to $ipad variable in the perl program...should i write it in perl or vb??if in perl, then how? thank you....

Replies are listed 'Best First'.
Re: how to assign a vb 6.0 variable value to a perl variable
by NetWallah (Canon) on Jan 09, 2013 at 06:06 UTC
    VB uses "&" as a string-concat operator, so you could write VB code to convert that into a perl variable like this:
    fname.WriteLine ("my $ipad_ip ='" & rec3("IPADDRESS") & "';")

                 "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius

      thank you NetWallah.....:)
      its what i was asking for......:) :) thank you againn.....:)
Re: how to assign a vb 6.0 variable value to a perl variable
by LanX (Saint) on Jan 09, 2013 at 06:01 UTC
    ( I won't start questioning this strategy!!! :)

    Technical answer:

    Include it as a literal string something like '124.55.222.1' (like you did with '23').

    Plz don't expect much help about VB's string concatenation¹ here to interpolate your variable, it's really off topic ( and I won't start googeling for you ;)

    Cheers Rolf

    ¹) + ?

      thank you for your response LanX

      actually the value of ip address changes everytime the entire program is run...but telnet port 23 is constant....so i cant put address in string!!

      can we pass this value using perl code??