Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

How to make changes in yaml file thorugh perl

by Anonymous Monk
on Jul 11, 2012 at 07:50 UTC ( #981037=perlquestion: print w/replies, xml ) Need Help??
Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I've to run a yaml file with some parameters through perl. Can someone tell me how can we pass parameters to yaml file and can execute them.
  • Comment on How to make changes in yaml file thorugh perl

Replies are listed 'Best First'.
Re: How to make changes in yaml file thorugh perl
by moritz (Cardinal) on Jul 11, 2012 at 07:53 UTC
      I think the OP wants to manipulate a YAML file with a Perl script (according to the title of the post), so yes, please do check out the various YAML handling modules on CPAN.
      My favourite is YAML::Tiny - simple and leight-weight and good for most cases. You would read the YAML file into a Perl data structure, manipulate the data in there and then dump it to a new YAML file (or overwrite the existing one). Have a go and post your code here if you are running into trouble.
        topso, I am able to fetch yaml contents but not getting how to make changes in any of the attribute and then save it back. Actually writing the changes in the .yaml file is becoming a pain. Can you help in this?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://981037]
Approved by moritz
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2018-04-22 22:31 GMT
Find Nodes?
    Voting Booth?