I think this question is best posed with an example:
Here's a sample array:
@array=qw(
11111
22222
33333
xxmeta
xxdata
);
There could be more, less, or no 'xx...', and the length of the array varies. Given that, how would I reference the last line in the array...
I've come up with a simple shell script that works, but I want to refine it a bit so maybe some others can use it. Basically, it allows to me open a file from certain directory regardless of my cwd:
vi `ls /home/jriggs/dox/*"$*" `Lets me just enter last part of the file, and there it is.
I...
Nice code rharsh. Would you mind breaking down line 3 a bit more *** grep(!$temp{$_}++ ***? Reminds me of some japhs I've seen. I'm still trying grasp hashes, thanks-
Because a thing seems difficult for you, do not think it impossible for anyone to accomplish.
Marcus Aurelius
Thanks for the links guys. The module seemed a bit like overkill for what I was going for, but It's good to know about in case I ever get real creative with this. I was a slow day at work, so I went ahead and did the script I was talking about. I'd like to put it up here for any critiques you...
I have a relatively small, but aggravating problem on my apache server. Some script kiddie somewhere keeps trying to telnet into my server with a very crude brute force prog. I see it in my auth.log file as
Jul 24 14:17:03 localhost sshd[4506]: Illegal user amanda from 218.202.223.244
Jul 24...
I'm pretty new to C#. Currently I am trying to work with Microsoft's 2005 Visual C# express. Here's what I'm trying to accomplish:
1) Browse to a word doc on my Computer
2) Read .doc into a text box
3) Do some modifications to the contents
4) ftp revised text in .txt format to my server
I am at...
Update:
So after digging through the the help section I found this codeif(openFile1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
// Load the contents of the file into a RichTextBox control:
rtbData.LoadFile(openFile1.FileName,
RichTextBoxStreamType.PlainText) Which works...
Hi All,
I'm totally new to OO programming, well more precisely microsoft .net style syntax. I recently downloaded Visual c# express, I want to learn, but am having a difficult time getting started. Mainly I think I'm searching the wrong terms. My first goal is to open a word doc in my...
I'm using a text file to hold some information about files, like a mini-database (I know, I know). I'm trying to write a little sub-routine that will let the user enter 1, 2, OR 3 terms, and will return results arranged by relevence. Like m/($term1 AND $term2 AND $term3) then m/($term1 AND...
Sorry, looking back, exit would have been the better choice of words. I was learning all about forking, so I had parents killing children on my mind when I wrote it. Still it's not too clear in my mind the difference between 'killing' a script and 'exit' they look to have the same net effect...
Thanks for the reply Paul. I'm not sure I completely follow the example you've given. I think I wasn't specific enough in the OP. I'm basically looking for an alternative to 'ctrl+y' (linux), or ctrl+alt+del (windows). Killing the script in this manner seems sloppy/inefficient/dangerous???, so I...
I'm looking for a way to kill a script on user input from the keyboard. I was originally trying to use a while loop, but that didn't really accomplish what I wanted (at least the the way I did it). Some folks over on the CB at perlmonks recommended using perl's fork function. I read the...
Follow-up:
In this directory I have 2 photos now, one is the thumbnail and the other is the actual fullsize jpg. I'm trying to create dynamic <a href's for the thumbs.
the files are formatted as such:
himom.jpg
himom.jpg.thumb.jpg So, as I'm looping thru, img src should be 'himom.jpg.thumb.jpg...
Sorry it took so long to get back. As I was reading through this thread again, I realized we weren't really addressing the issue I was have the *most* problems with. I'll try to detail it out again.
I have two separate programs. One formats the input data, into a temporary file. The second goes...
Of course, order of operations. Sometimes I lose the forest for all the trees, or is it the other way around? Thanks for the advice.
Does anyone know a better way to write
{print "<img src=\"\/uploads\/$file\" border=0 width=\"40\" height=\"40\"><br>";} I've not been able to get 'qw()' to work...
I wasn't sure if I should post here, or in the cgi forums, but I think my problem is more perl than anything else. This script
#!/usr/bin/perl
use CGI qw(:standard);
use Image::Magick;
print header;
print "<link rel=\"stylesheet\" ";
print "type=\"text\/css\"...
You're correct Steve, the 'g' is in fact, pointless, I hadn't noticed that, but it still achieves the desired output. Basically, I need to clean up the data before I can process it. In data could look like this:
___INDATA______
1. qqqq
www
eee
2. wwww
rrr
rrr
___OUTDATA___
1. qqqq
www
eee
2...
Hi All-
I have the following code which is pretty straight forward, for getting data into a form the 'real' script can use.
7 while ($ln=<DATA>){if ($ln!~ /^\s*$/){
8 $ln=~ s/(^[1-9])/\n$1/g;
9 push @goodat , $ln;}
} This output looks as it should when I print...
Well, I have not switched over to the 'upload()' method yet. If anyone writes an FAQ, I'd be more than happy to have a go at on my server. If not, I'll eventually get around to using the link Ishnid provided. (it's hard to get motivated to replace something that works :\ )
Because a thing seems...
Heh, figures, I just got the other one to work. So far, I've been uploading text files with no problem. Do you know of any issues in uploading larger files, say for example, mp3/avis? I'm not worried about maintaining ftp type connections (ability to resume broken xfers), but am more interested...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.