Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: perl script for adding information to c file.

by Utilitarian (Vicar)
on Oct 10, 2011 at 09:06 UTC ( #930561=note: print w/replies, xml ) Need Help??

in reply to perl script for adding information to c file.

#!/usr/bin/perl use warnings; use strict; open (my $code , "<", 'ccode.c')||die "Could not open ccode.c\n\t$!"; my %data = ('24'=>"temperature", '25'=>"pressure", '26'=>"humidity", ); my %nums = ('24'=>"information1: ", '25'=>"information2: ", '26'=>"information3: ", ); %data = reverse %data; my $test_string="(" .join("|", keys %data).")" ; while(<$code>){ if (/$test_string/){ $_=$nums{$data{$1}}.$_; } print $_ }
I could have sworn I saw this over on last week....?
Anyway, I hope this resolves your question.
print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://930561]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2016-10-23 16:44 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (301 votes). Check out past polls.