Putting the file into the @cards array? Check. (It prints properly with print (@cards);, which I didn't think it was supposed to.)
Splitting properly? Are you splitting by whitespace or something else equally inane? Nope, it looks right - but it doesn't WORK.
All I get from running the program as it appears it SHOULD run to me is uninitalized variable errors in my format lines and the one line where I use the variables $name, $stock, and $shown - all of which are DECLARED at the beginning of the program with my.
However, I believe there's a way around it. I'll just declare those variables *INSIDE* the function. I don't need them outside of it; I declared them globally because I always had trouble with local/global and variable assignment before, when I was working with...
Anyway, the point is, I *think* I have a solution. (I really really don't think the code for the sort/insertion is going to be hard at all. Now that I know how to stick a value onto the end of the array, I just need to figure out how to work that whole circular-revolving list thingie, shift, I think, and it's essentially done.)
And to think you have a solution is to be partially there.