my $data=do {local $/;}; $data=~s/\(\s*(\w+)(\W)/$1\($2/gs; # s-expr -> m-expr functions $data=~s/\)(?=[\s\w]+)/),/g; # comma after functions $data=~s/\s([\w"\\]+)(?=[\s)])/$1,/g; # comma separated args print $data; #### __DATA__ (global short rounds_completed 0) (script static unit player (unit (list_get (players) 0))) (script static void music_ambercladremix (sound_looping_start "sound\moooseguy\sound_looping\ambercladremix" none 1) ) (script dormant death_cutscene (enable_hud_help_flash false) (show_hud_help_text false) (sleep 30) (camera_set death7 100) (sleep 50) (camera_set death8 110) (cinematic_set_title gameover) (sleep 150) (fade_out 0 0 0 30) (sleep 50) (cinematic_stop) (wake credits_cutscene) ) #### global(short,rounds_completed,0,), script(static,unit,player, unit( list_get( players(),0,))), script(static,void,music_ambercladremix, sound_looping_start( "sound\moooseguy\sound_looping\ambercladremix", none,1,), ), script(dormant,death_cutscene, enable_hud_help_flash(false,), show_hud_help_text(false,), sleep(30,), camera_set(death7,100,), sleep(50,), camera_set(death8,110,), cinematic_set_title(gameover,), sleep(150,), fade_out(0,0,0,30,), sleep(50,), cinematic_stop(), wake(credits_cutscene,), ), #### &death7; death6(); sub AUTOLOAD { print "undefined sub $AUTOLOAD was called\n"; }