Ajit P Singh wrote:
> Thanks Rob for your reply...
>
> My problem is :the values i pick up from is actually not a file.(Sorry about
> that)
>
> The values are stored as an array of structs as key value pairs  i.e
> /thus/axioss/serviceID:123456
> /thus/axioss/supplierProduct:Test Stream 100
> /thus/axioss/web/installationTelephoneNumber:020837111663
>
> I hope i am being clear now.

OK, but your original post said:

> How can I do away with the hard coded keys?

and I'm not sure how you want to 'do away' with them. They have
to come from somewhere, and the obvious place is something like
a config file. Is that what you mean?

Ah, perhaps light dawns?

Does this do something like what you want?

(BTW it helps to always use single quotes unless you specifically
want to interpolate variables or control characters)

HTH,

Rob



  my $self = {
    serviceID => '123456',
    supplierProduct => 'BT IPStream 500',
    installationTelephoneNumber => '020837111663',
  };

  my $str = './place_order -t';

  for (qw|
    /thus/axioss/serviceID
    /thus/axioss/supplierProduct
    /thus/axioss/web/installationTelephoneNumber |) {

    my ($key) = /(\w+)$/;
    $str .= qq| $_:"$self->{$key}"|;
  }

  $str .= "\n";

  print $str;

**OUTPUT

./place_order -t /thus/axioss/serviceID:"123456" /thus/axioss/supplierProduct:"BT 
IPStream 500"
/thus/axioss/web/installationTelephoneNumber:"020837111663"



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to