Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Ramzi
Oct 10, 2004
The inner child of my soul was repeatedly gangbanged by a team of mall Santas.

Neurozys posted:

http://en.wikipedia.org/wiki/Binary_to_text_encoding

Usenet would be so boring without it ;)
Holy poo poo. I love when I independently come up with something that already exists.

Adbot
ADBOT LOVES YOU

Pardot
Jul 25, 2001




Neurozys posted:

http://en.wikipedia.org/wiki/Binary_to_text_encoding

Usenet would be so boring without it ;)

Wait... You're telling me I can get things other than discussions from usenet? :aaa:


That'd be a great way to distribute open source stuff like linux ISOs.

FlyingDodo
Jan 22, 2005
Not Extinct

Ramzi posted:

Alright. In my mind when I think text I think ASCII. I have no prefence for ASCII, just the idea.

I've tried that. It still knows, some how. I think it reads the file header, which I don't know so much about. If this is the case, is there a way to, given any binary, make it look like it's a text file, and then revert it back to what it was originally? If so, this program would be preferable to my original idea.

I'll try this.

edit: how much do you want it changed? do you want it to only use the letters?

FlyingDodo fucked around with this message at 06:59 on Jun 5, 2007

FlyingDodo
Jan 22, 2005
Not Extinct
I've written the program (although the text file it outputs is 2x the size of the original). Except I can't work out what I'm supposed to do on tinyappz.com.

Cool Matty
Jan 8, 2006
Usuyami no Sekai
I have a funky request. I don't know if this qualifies for "tiny" but hell it's worth a shot:

Premise: a system tray shoutcast audio player.

Possible features (besides playing a stream):

1. Popups with current song/artist info
2. "Global Hotkeys"-like feature (Just for Play/Stop)
3. Ability to play/stop by clicking the task icon.
4. Any settings (stream URL, buffer, popups on/off) on a right click menu

Probably a bit more work than you all are interested in, but I'm really just looking for a simple no-frills replacement for Winamp on shoutcast stream playing.

Neurozys
Apr 15, 2004

FlyingDodo posted:

I've written the program (although the text file it outputs is 2x the size of the original). Except I can't work out what I'm supposed to do on tinyappz.com.

1. Create an account here http://tinyappz.com/index.php?title=Special:Userlogin&type=signup
(I don't care if you use real info or not, and there's no confirmation process)
2. Go to http://tinyappz.com/wiki/Special:Upload and upload a zip file containing your project.
3. Go to http://tinyappz.com/wiki/Add_Application
Fill out as much information as you have and hit the 'Add New Application' button.
For the "File (must upload)" field use the name of the file you just uploaded.
4. You'll be brought to a new page for your app. Edit any more information you want to provide into it just like any wiki.

TinyAppz.com main page posted:

Filling Requests

1. Create a new page for your application using the Add Application page or Application Template.
* Screen shots are encouraged.
2. Upload your application to this site.
* Applications must be in a zip or rar archive to be uploaded.
* You may provide your own file hosting, but I recommend at using this site to provide an alternate download link.
3. Mark the request as filled
* Follow the # link from the Open Requests list.
* Add the line "|filled = Application Name" to the request.
4. Post a link to the new page in the Request a tiny custom app thread at SomethingAwful.com.

FlyingDodo
Jan 22, 2005
Not Extinct
I hope I did everything right and I hope this program does what was wanted.
http://tinyappz.com/wiki/BinaryText

Ramzi
Oct 10, 2004
The inner child of my soul was repeatedly gangbanged by a team of mall Santas.
Thank you. Why only A-Q, though?

Neurozys
Apr 15, 2004

FlyingDodo posted:

I hope I did everything right and I hope this program does what was wanted.
http://tinyappz.com/wiki/BinaryText

Well, the page is fine (a lot better then most of them come out at first) I did a couple minor edits, just shortened the description and removed the source file link, since it was the same file as the exec.

I just realized I haven't contributed an app in quite a while . . . I should probably do one sometime.

FlyingDodo
Jan 22, 2005
Not Extinct

Ramzi posted:

Thank you. Why only A-Q, though?

It splits the bytes into two bytes, only 4 bits are stored in each of the two bytes. So each one of those half bytes can only store 0 - 15. Then it adds add on 65 so that all the values will appear as letters when opened as a text file. So each byte in the text file will only store something in range from 65 - 80, which are the letters A through Q.

Inquisitus
Aug 4, 2006

I have a large barge with a radio antenna on it.
Could've used base64 ;)

Dicky B
Mar 23, 2004

I'd like a program that temporarily disables my keyboard so that when I spill something on it I can wipe down all the keys without accidentally causing stuff to happen on screen.

http://www.tinyappz.com/wiki/Request:1181241385

Neurozys
Apr 15, 2004

Dicky B posted:

I'd like a program that temporarily disables my keyboard so that when I spill something on it I can wipe down all the keys without accidentally causing stuff to happen on screen.

http://www.tinyappz.com/wiki/Request:1181241385

I was about to do it but when I searched for a method of disabling the keyboard this came up http://www.dirfile.com/clean_n_go.htm

Dicky B
Mar 23, 2004

Neurozys posted:

I was about to do it but when I searched for a method of disabling the keyboard this came up http://www.dirfile.com/clean_n_go.htm
That is perfect but apparently it's a 30-day evaluation period. Since I clean my keyboard less than once every 30 days it's basically useless :sigh:

kaniff
Feb 27, 2004

oh word?

Dicky B posted:

I'd like a program that temporarily disables my keyboard so that when I spill something on it I can wipe down all the keys without accidentally causing stuff to happen on screen.

http://www.tinyappz.com/wiki/Request:1181241385

Does this happen frequently enough that you need something to automate it?

Also, what is wrong with unplugging it?

DLCinferno
Feb 22, 2003

Happy

kaniff posted:

Does this happen frequently enough that you need something to automate it?

Also, what is wrong with unplugging it?
Even better just press Windows Key-L. Pound away on it and then just log back in when you're done.

Sizzlechest
May 7, 2007

Ramzi posted:

Alright. In my mind when I think text I think ASCII. I have no prefence for ASCII, just the idea.

UUEncode, yEnc, etc. are ASCII. Dude, you're trying to reinvent the wheel.

Neurozys
Apr 15, 2004

I doubt anyone cares, but some unidentified person asked me over AIM to add a feature to Random Opener (to be able check subdirectories.) So I rewrote it in C#, since it's been so many months since I've used MFC that I couldn't get the original code to do what I wanted.

Anyway, new version here - http://www.tinyappz.com/wiki/Random_Opener

theodop
Dec 30, 2005

rock solid, heart touching

kaniff posted:

Does this happen frequently enough that you need something to automate it?

Also, what is wrong with unplugging it?

This would've been useful to me until I learned to move the bong AWAY from the keyboard during use.

Charles Ford
Nov 27, 2004

The Earth is a farm. We are someone else’s Ford Focus.

Cool Matty posted:

I have a funky request. I don't know if this qualifies for "tiny" but hell it's worth a shot:

Premise: a system tray shoutcast audio player.

Possible features (besides playing a stream):

1. Popups with current song/artist info
2. "Global Hotkeys"-like feature (Just for Play/Stop)
3. Ability to play/stop by clicking the task icon.
4. Any settings (stream URL, buffer, popups on/off) on a right click menu

Probably a bit more work than you all are interested in, but I'm really just looking for a simple no-frills replacement for Winamp on shoutcast stream playing.

Years ago, I wrote a system tray media player, with Shoutcast support. It has a stay-on-top optionally transparent window with current song info, but it's a bit buggy. Ask fellow goon Scorponok as he also used to use it. It also has context menu-based file browsing, supports all the same files as Windows Media Player (via DirectShow) and nice scrolling text. It already satisfies requirement 3, possibly 1 (static window okay?), plenty of options on 4, only really needs bugfixing plus 2.

If anybody was interested I could probably release the source or something, so it could be fixed and updated freely. I initially had the notion of selling it as shareware but decided against it, despite me still using it now. It's not a tiny app by any means.

Edit: Oh, screenshots!
http://mice-software.com/blah/trayplay.jpg
http://mice-software.com/blah/trayplay2.jpg
http://mice-software.com/blah/trayplay3.jpg
These are all old, pre-Shoutcast support I think.

Charles Ford fucked around with this message at 12:33 on Jun 8, 2007

Run
Oct 14, 2005

by Lowtax
I don't know how 'tiny' this program would be because I have no idea how difficult it would be to make. But the task it needs to do is pretty simple.

In a nutshell: A program that automatically visits particular webpages and downloads particular files from them to a particular directory.

Why: I want to be able to download a large number of .torrent files simultaneously while exerting as little effort as possible (currently, I have to click each one in turn, on a huge list, which is horribly tedious)

I would like the program to do the following. I'm going to try and be as clear as possible, but if anything is confusing or I have left out a critical piece of information the program would need, please do tell me:

1. The program opens a text file (which is in the same directory) called "urls.txt", which contains a list of URLs.

2. It visits the first URL, and searches the webpage code for URLs of this format:

http://www.bt-chat.com/download.php?info_hash=XXXX

Where XXXX is any alphanumeric 40-character string.

3. It then visits each and every one of those URLs, each one initating a download of a torrent file. However, the program should never visit the same URL twice, so it needs to remember the XXXX's it has already visited (by saving them to a file, so it remembers them every time the program is run)

4. It puts all these torrent files in a particular directory (perhaps this directory is the first list item in urls.txt? that would make it easy to customise)

7. The program then moves onto the next list item and repeats, and then closes after the last list item.

Ideally it would also automatically open all the files it downloads, in the default program, but that's not an essential aspect. In fact, it doesn't really have to save the torrent files. If it can just initiate the downloads, then I can just click repeatedly in Firefox to accept them all.

Segaholic2
Jun 6, 2003

Neurozys posted:

I doubt anyone cares, but some unidentified person asked me over AIM to add a feature to Random Opener (to be able check subdirectories.) So I rewrote it in C#, since it's been so many months since I've used MFC that I couldn't get the original code to do what I wanted.

Anyway, new version here - http://www.tinyappz.com/wiki/Random_Opener

That was me. Thank you very much!

DLCinferno
Feb 22, 2003

Happy

Run posted:

I don't know how 'tiny' this program would be because I have no idea how difficult it would be to make. But the task it needs to do is pretty simple.
Almost everything you're requesting is already done in a firefox extension:

https://addons.mozilla.org/en-US/firefox/addon/201

You just need to actually visit the page, then it will remember the filtering and automatically get all the torrent files.

heeen
May 14, 2005

CAT NEVER STOPS
Requesting a tool that pops a balloontip in the tray everytime someone accesses a network shared file!

Run
Oct 14, 2005

by Lowtax

DLCinferno posted:

Almost everything you're requesting is already done in a firefox extension:

https://addons.mozilla.org/en-US/firefox/addon/201

You just need to actually visit the page, then it will remember the filtering and automatically get all the torrent files.

I gave it a try and that's pretty nifty, but it doesn't remember which ones it's already gathered, which is a rather crucial aspect of what I'm after. Still, thanks for the link - I'll find that addon useful elsewhere regardless

NoneMoreNegative
Jul 20, 2000
GOTH FASCISTIC
PAIN
MASTER




shit wizard dad

Something I thought of the other night:

The what:

A screensaver that will look in a user-defined directory and play back either all video files in that directory or one selected file.

Now, the bit that all the other video screensaver programs don't do; it should pick a random point within the video file, and play from there, looping back to the start of the file seamlessly.

It should also have a mute checkbox, and a slider (or other option) to fade brightness of the video from full down to 10%

The why:

I've ripped my copies of Koyaanisqatsi, Powaqqatsi, Baraka and Chronos to 2CD avis from the DVDs, and I'd love to be able to get a random scene from one of them playing if I leave the pc for a while.

Note; I'm running XP Pro at the moment, but may be shelling out many clams for a MacBook Pro in the future, so any Mac tinkerers who want to have a shot, feel free :)

cheesypeanut
Apr 4, 2004
w3rd. ngr wut.

heeen posted:

Requesting a tool that pops a balloontip in the tray everytime someone accesses a network shared file!

I'd be quite interested in this as well.

Paul MaudDib
May 3, 2006

TEAM NVIDIA:
FORUM POLICE
One of my big pet peeves is that all the programs in the startup folder try to start at the same time. They usually end up slowing each other down to the point where a system is unusable for the first few minutes. I'd like a program that would keep track of the shortcuts, and launch them at a particular time, so that their launch is staggered over an adjustable period of time.

A windows application that does the following:
1. Starts at system startup (startup folder is just fine here)
2. Finds any shortcuts to applications that will start at startup
3. Moves them into a folder and creates an entry in the INI file, possibly throwing up a window to ask you for the length of that time for the shortcut
4. Maintains an INI of shortcuts, which you can use a miniature interface to set a time in seconds. This might best be done in an external program so it doesn't quit with the rest of the program.
5. It runs a countup timer, when it reaches a shortcut's particular time, it will launch that shortcut
6. After it finishes the last task, it exits itself.

http://www.tinyappz.com/wiki/Request:1181950095

ijustam
Jun 20, 2005

I'm probably going to be doing massive amounts of databasing in the future... so unless someone has a better alternative that picking stuff off the web and putting it into a CSV file myself, I'd like to hear it. Until then, I'd very much appreciate it if someone could make this app:

I don't need it to translate anything, really. I will edit/monitor the files before I feed them. I just need the program to take the tab-separated values (which are in rows) and turn them into columned CSVs. For example:

Before [there are tabs here but they do not translate]

quote:

AGP Slots None
PCI Express x16 1
PCI Express x1 2
PCI Slots 3

After:

quote:

None,1,2,3

The challenge, maybe: I run Linux.

Sizzlechest
May 7, 2007

ijustam posted:

I don't need it to translate anything, really. I will edit/monitor the files before I feed them. I just need the program to take the tab-separated values (which are in rows) and turn them into columned CSVs. For example:


I'd say use a Perl script. Something along the lines of:

code:
#!/usr/bin/perl -w

$i = 0;

while ( <> )
{
  ( $array[$i++] ) = /^.*?\t.*?\t(.*?)$/;
}

print join(",", @array), "\n";
Would give the right output of the above example. Do you need all the rows transposed? Are the number of columns fixed?

Sizzlechest fucked around with this message at 04:19 on Jun 17, 2007

ijustam
Jun 20, 2005

Sizzlechest posted:

I'd say use a Perl script. Something along the lines of:

code:
#!/usr/bin/perl -w

$i = 0;

while ( <> )
{
  ( $array[$i++] ) = /^.*?\t.*?\t(.*?)$/;
}

print join(",", @array), "\n";
Would give the right output of the above example. Do you need all the rows transposed? Are the number of columns fixed?

All of the rows will be read. I will delete unnecessary rows before entry. The number of columns is varied between files.

Edit: I understand your code, except for this: ( $array[$i++] ) = /^.*?\t.*?\t(.*?)$/;

Could you explain to me what this does?

ijustam fucked around with this message at 04:37 on Jun 17, 2007

Sizzlechest
May 7, 2007

ijustam posted:

All of the rows will be read. I will delete unnecessary rows before entry. The number of columns is varied between files.

Edit: I understand your code, except for this: ( $array[$i++] ) = /^.*?\t.*?\t(.*?)$/;

Could you explain to me what this does?

It's a regular expression to ignore all but the third column since that's the example you gave. I rewrote it to do a true transpose on any tab-delimited input and yield a CSV output:

code:
#!/usr/bin/perl -w

while ( <> )
{
  chomp;
  push @array, [ split ( /\t/ ) ];
}

for $i ( 0 .. $#{$array[0]} )
{
  for $j ( 0 .. $#array )
  {
    if ( $j == $#array )
    {
      print $array[$j][$i], "\n";
    }
    else
    {
      print $array[$j][$i], ",";
    }
  }
}
Since the input was tabbed, do you need to worry about commas in the data? How would you like them escaped?

Sizzlechest fucked around with this message at 04:55 on Jun 17, 2007

ijustam
Jun 20, 2005

Sizzlechest posted:

Since the input was tabbed, do you need to worry about commas in the data? How would you like them escaped?

If there's a comma in the input, it probably shouldn't be in there to begin with. If it errors and halts that's probably a good thing.

It's going to be fed into a SQL database, so unless \n won't work with SQL (which I don't know why it wouldn't but I'm not in charge of the massive coding, only the databasing), go ahead and use a standard return.

Sizzlechest
May 7, 2007

ijustam posted:

If there's a comma in the input, it probably shouldn't be in there to begin with. If it errors and halts that's probably a good thing.

It's going to be fed into a SQL database, so unless \n won't work with SQL (which I don't know why it wouldn't but I'm not in charge of the massive coding, only the databasing), go ahead and use a standard return.

The newline character is based on the OS you are using. If you are using Linux, the newline will be a linefeed. On DOS, it's a carriage return AND linefeed. On a MAC, it's a carriage return only. Feel free to use a "\015" if it makes you happy. However, if you run this on DOS, the output will be in Linux (Unix) format only. I added comments to the code:

code:
#!/usr/bin/perl -w

# Read from input file or from STDIN.
while ( <> )
{
  # Strip off newline.
  chomp;

  # Split up data on the tab character and store as unnamed array.
  # Store unnamed arrays in master array.
  push @array, [ split ( /\t/ ) ];
}

# The $#{$array[0]} is the "size - 1" of the first row (e.g., number of columns.)
for $i ( 0 .. $#{$array[0]} )
{
  # The $#$array is the "number of rows - 1" or "size - 1" of the array.
  for $j ( 0 .. $#array )
  {
    if ( $j == $#array )
    {
      # End of transposed row, print newline.
      print $array[$j][$i], "\n";
    }
    else
    {
      # Convert to CSV format.  WARNING: commas are NOT escaped!
      print $array[$j][$i], ",";
    }
  }
}

ijustam
Jun 20, 2005

Sizzlechest posted:

The newline character is based on the OS you are using. If you are using Linux, the newline will be a linefeed. On DOS, it's a carriage return AND linefeed. On a MAC, it's a carriage return only. Feel free to use a "\015" if it makes you happy. However, if you run this on DOS, the output will be in Linux (Unix) format only. I added comments to the code:

codecodecode
So far this is absolutely awesome. I only have two questions; this is my output:
code:
Brand,Series,Model,Interface,Capacity,Cache,Average Seek Time,Average Latency,RPM,Form Factor
Western Digital,Scorpio,WD800VE,ATA-6,80GB,8MB,12ms,5.5ms,5400 RPM,2.5"
The second line is perfect. The first line is nice, but unnecessary. Is there a way to trim off the first part?

Also, is there a way to have to recognize a separator, such as "--Null--" and have it finish that array and continue to another? I ask this so I can mash a lot of data into one file instead of a million small files.

Sizzlechest
May 7, 2007

ijustam posted:

So far this is absolutely awesome. I only have two questions; this is my output:
code:
Brand,Series,Model,Interface,Capacity,Cache,Average Seek Time,Average Latency,RPM,Form Factor
Western Digital,Scorpio,WD800VE,ATA-6,80GB,8MB,12ms,5.5ms,5400 RPM,2.5"
The second line is perfect. The first line is nice, but unnecessary. Is there a way to trim off the first part?

So you literally only want the last column of the original tab delimited file as a single row of CSV data? If so, that ought to be easy. You don't need the outer loop. Just use the last column:

code:
#!/usr/bin/perl -w

# Read from input file or from STDIN.
while ( <> )
{
  # Strip off newline.
  chomp;

  # Split up data on the tab character and store as unnamed array.
  # Store unnamed arrays in master array.
  push @array, [ split ( /\t/ ) ];
}

# The $#$array is the "number of rows - 1" or "size - 1" of the array.
for $j ( 0 .. $#array )
{
  if ( $j == $#array )
  {
    # End of transposed row, print newline.
    print $array[$j][$#{$array[0]}], "\n";
  }
  else
  {
    # Convert to CSV format.  WARNING: commas are NOT escaped!
    print $array[$j][$#{$array[0]}], ",";
  }
}

ijustam posted:

Also, is there a way to have to recognize a separator, such as "--Null--" and have it finish that array and continue to another? I ask this so I can mash a lot of data into one file instead of a million small files.

Probably, but I'd need to see an example.

ijustam
Jun 20, 2005

Sizzlechest posted:

Probably, but I'd need to see an example.

Here is the current file:

quote:

Brand Western Digital
Series Scorpio
Model WD800VE
Interface ATA-6
Capacity 80GB
Cache 8MB
Average Seek Time 12ms
Average Latency 5.5ms
RPM 5400 RPM
Form Factor 2.5"

Ideally it would go like this:

quote:

Brand Western Digital
Series Scorpio
Model WD800VE
Interface ATA-6
Capacity 80GB
Cache 8MB
Average Seek Time 12ms
Average Latency 5.5ms
RPM 5400 RPM
Form Factor 2.5"
random separator here
Brand Western Digital
Series Caviar SE16
Model WD3200AAKS
Interface SATA 3.0Gb/s
Capacity 320GB
RPM 7200 RPM
Cache 16MB
Average Seek Time 8.9ms
Average Write Time 10.9ms
Average Latency 4.2ms
Form Factor 3.5"
separator here
ETC...

Sizzlechest
May 7, 2007
Oh, so you want to process multiple files. Each row in the output is the last column from each file in CSV format, yes?

Here you go:

code:
#!/usr/bin/perl -w

# Read from input file or from STDIN.

sub transpose
{
  # Local variables.
  my ( @array, $j );
  
  foreach ( @_ )
  {
    # Strip off newline.
    chomp;

    # Split up data on the tab character and store as unnamed array.
    # Store unnamed arrays in master array.
    push @array, [ split ( /\t/ ) ];
  }

  # The $#$array is the "number of rows - 1" or "size - 1" of the array.
  for $j ( 0 .. $#array )
  {
    if ( $j == $#array )
    {
      # End of transposed row, print newline.
      print $array[$j][$#{$array[0]}], "\n";
    }
    else
    {
      # Convert to CSV format.  WARNING: commas are NOT escaped!
      print $array[$j][$#{$array[0]}], ",";
    }
  }
}

# main

@ARGV >= 1 or die "Please provide a list of filenames.\n";

foreach my $arg ( @ARGV )
{
  open( FILE, $arg ) or die("Could not open file!\n");
  @data = <FILE>;
  close( FILE );
  transpose( @data );
}
Assuming you call the file "trans.pl," you would use it on the command line as:

code:
./trans.pl file1 file2 file3 ... fileN

ijustam
Jun 20, 2005

Sizzlechest posted:

Oh, so you want to process multiple files. Each row in the output is the last column from each file in CSV format, yes?

You're close. The output is perfect, however, I want it to read one file with multiple sets of data. I want the program to see a certain character, output what it has, and begin again from where it stopped.

Here is our example source file:

quote:

Brand Western Digital
Series Scorpio
Model WD800VE
Interface ATA-6
Capacity 80GB
Cache 8MB
Average Seek Time 12ms
Average Write Time
Average Latency 5.5ms
RPM 5400 RPM
Form Factor 2.5"
%%%%NEW%%%%
Brand Western Digital
Series Caviar SE16
Model WD3200AAKS
Interface SATA 3.0Gb/s
Capacity 320GB
Cache 16MB
Average Seek Time 8.9ms
Average Write Time 10.9ms
Average Latency 4.2ms
RPM 7200 RPM
Form Factor 3.5"

The program would read the first set of data, and when it hits our separator (%%%%NEW%%%%) it will output the array and begin a new array consisting of the second set of data, then repeat for the third and fourth until it hits EOF.

I apologize if I'm being a bit anal; you are doing me such a big favor and saving me so much time in the long run.

Edit: Just realized the two example data sets aren't identical in syntax. Not a big deal but possibly a bit confusing (fixed).

ijustam fucked around with this message at 06:03 on Jun 17, 2007

Adbot
ADBOT LOVES YOU

Sizzlechest
May 7, 2007
How's this? It only accepts one file and I used your "%%%%NEW%%%%" literally.

code:
#!/usr/bin/perl -w

sub transpose
{
  # Local variables.
  my ( @array, $j );
  
  foreach ( @_ )
  {
    # Strip off newline.
    chomp;

    # Split up data on the tab character and store as unnamed array.
    # Store unnamed arrays in master array.
    push @array, [ split ( /\t/ ) ];
  }

  # The $#$array is the "number of rows - 1" or "size - 1" of the array.
  for $j ( 0 .. $#array )
  {
    if ( $j == $#array )
    {
      # End of transposed row, print newline.
      print $array[$j][$#{$array[0]}], "\n";
    }
    else
    {
      # Convert to CSV format.  WARNING: commas are NOT escaped!
      print $array[$j][$#{$array[0]}], ",";
    }
  }
}

# main

@ARGV == 1 or die "Please provide a filename.\n";

open( FILE, $ARGV[0] ) or die("Could not open file!\n");
@data_all = <FILE>;
close( FILE );

foreach my $line ( @data_all )
{
  chomp $line;
  if ( $line eq "%%%%NEW%%%%" )
  {
    transpose( @data );
    undef @data;
  }
  else
  {
    push( @data, $line );
  }
}
transpose( @data );
It's too late to comment all the changes. I'll leave that as an exercise to the reader. :)

  • Locked thread