Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

RE: Multiple file reading

by perlmonkey (Hermit)
on Jul 27, 2000 at 07:27 UTC ( #24622=note: print w/replies, xml ) Need Help??


in reply to Multiple file reading
in thread Multiple file reading

I think this is what you want:
@a = split //, 'xx110'; @b = split //, '001xx'; splice @a, ++$i, 0, $_ or $i++ for(@b); print @a, "\n";
Results: x0x0111x0x
You just have to read in each line of your files, then split the characters into an array. The splice line is sort of tricky. It inserts each element of @b into @a, at the 1st, 3rd, 5th ... position of @a. I hope this helps. There may be another and better way to merge arrays, but I cant think of one right now.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://24622]
help
Chatterbox?
[marto]: Discipulus, what did you have in mind?
[marto]: sort of related, have you seen sonic pi
[Discipulus]: choroba less than perl -le ' $==1,(1 x $_)=~/(^)(1|11\1 )*(?{$=++})^/, print $= for 0..10'?? congrats
[Discipulus]: marto i had in mind something for stupid peoples with smart phones; a free app (this is the the non perl part..) and some hardware to sell in big cities
[marto]: use libPD on Android/IOS, route to something listening on the pi :P
[marto]: libpd
[marto]: OSC

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2017-10-17 10:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (225 votes). Check out past polls.

    Notices?