eviltom has asked for the wisdom of the Perl Monks concerning the following question:
i would like to use the ruby in perl anyboday can help.
#!ruby # # Cut header of SPL in spool folder to raw EMF # def spl2emf(fnm) File.open(fnm + ".emf", "wb") {|fo| File.open(fnm, "rb") {|fi| str = fi.read pos = str.index(" EMF") if pos == nil print "No EMF marker found; probably wrong file\n" next end fo.write(str[(pos-40)..-1]) } } end if __FILE__ == $0 ARGV.each {|fnm| print fnm, "\n" spl2emf(fnm) } end
-----------------------------------------
pos = str.index(" EMF")########## i don't know syntex in perl
fo.write(str(pos-40)..-1) ########i don't know syntex in perl
------------------------------------------#perl $infile = "08017.SPL"; $outfile = "08017.SPL.emf"; open FH1,"<$infile"; $info = <FH1>; close FH1; # # # open FH2,">$outfile"; print FH2 $info close FH2 #end
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: help in ruby code to perl
by jwkrahn (Abbot) on Sep 20, 2009 at 07:21 UTC | |
by ikegami (Patriarch) on Sep 20, 2009 at 15:16 UTC | |
by jwkrahn (Abbot) on Sep 20, 2009 at 17:30 UTC | |
by ikegami (Patriarch) on Sep 20, 2009 at 17:51 UTC | |
by jwkrahn (Abbot) on Sep 20, 2009 at 18:44 UTC | |
| |
|
Re: help in ruby code to perl
by Anonymous Monk on Sep 20, 2009 at 04:20 UTC |