To make the long story short, I have to write a ton on assignments (e.g.
id.text = client.id) for our database project. And as it turns out, we also need code which does the assignments the other way around. Too lazy to do it manually, I wrote a short Perl script to do the job:
Perl:
| #!/usr/bin/perl
|
| use strict;
|
|
|
| my $input;
|
|
|
| while( chomp( $input = <STDIN> ) ) {
|
| $input =~ s/(.*?)(\s*)([^\s=]+?)(\s*)=(\s*)([^\s=;]+)(\s*)(.*?)/$1$2$6$4=$5$3$7$8/;
|
| print "$input\n";
|
| } |