Read file symbol by symbol?

Friends,
how read a file one by one symbols, not a whole string once at time?
Thanks.
-- 
-----------!
My blessing!
Ramis.     !
-----------!

http://www.samtan.fromru.com
mailto: samtan@fromru.com

0
Ramis
4/16/2002 7:56:30 PM
perl.beginners 29388 articles. 4 followers. Follow

4 Replies
825 Views

Similar Articles

[PageSpeed] 17

Here is one script I used to inspect files

use strict;
my $fn;
print"Enter the name of a file you want to examine ";
while (<>) {
 $fn = $_;
 last if $fn;
}
print "Opening $fn\n";
open TF, "$fn" or die "Cannot open $fn:$!\n";
my @ov;
my $ov;
while (<TF>) {
 @ov = unpack('U*',$_);
 print;
 print"\t\t";
 foreach $ov (@ov) {
  print"-$ov-";
 }
 print "\n";
}
close TF;

HTH

"Ramis" <Ramis@karaaltyn.ru> wrote in message
news:3CBC81EE.A25A79AF@karaaltyn.ru...
> Friends,
> how read a file one by one symbols, not a whole string once at time?
> Thanks.
> --
> -----------!
> My blessing!
> Ramis.     !
> -----------!
>
> http://www.samtan.fromru.com
> mailto: samtan@fromru.com
>


0
dkirol
4/16/2002 12:42:56 PM
Dave K wrote:

> Here is one script I used to inspect files
>
> use strict;
> my $fn;
> print"Enter the name of a file you want to examine ";
> while (<>) {

   It is better to write this as while (<STDIN>). The reason being if all
the command
   line arguments (if any are provided) have not been shifted out, a <>
will treat the
   next available arg as a file and try to read from it. This is not an
issue if the script
   takes no command line args, but still...

>
>  $fn = $_;
>  last if $fn;
> }

    This could just have been written as chomp ($fn = <STDIN>).
    To reply to the OP's question

     Setting $/ (Input Record Separator, perldoc perlvar) to " " might
help.
     This assumes that your symbols are separated by just one space.
      Another option would be to read in line by line and split on \s+ to
get the
      individuals symbols.

   HTH,
   Sudarsan


0
sraghav
4/16/2002 1:38:06 PM
> how read a file one by one symbols, not
> a whole string once at time?

You don't want to, reading one character
at a time is VERY slow.  At worst, the
operating system will cut short your
time slot whilst it waits for the file
access - perhaps limiting you to a few
dozen characters per second...

if you care much for that approach,
have a look at sysopen/sysread.

A better approach is to read a line at
a time, and split it down into symbols.
However, it's unlikely you actually need
to do this in Perl.  This works:

my @chars = split //, $string;

The best approach, is to read fixed sized
blocks with sysread and then split into
symbols.

NB: I said you rarely need to split into
symbols, why?  Because Perl has one of the
most expressive regular expression engine
in existance, that does almost all the text
manipulation you could ever require.

If it's not text manip, I'd like to know
what happens to these symbols :)

Take care,

Jonathan Paton

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
0
jonathanpaton
4/16/2002 4:02:48 PM
"Jonathan E. Paton" wrote:
 
> You don't want to, reading one character
> at a time is VERY slow.  At worst, the
> operating system will cut short your
> time slot whilst it waits for the file
> access - perhaps limiting you to a few
> dozen characters per second...
> 
> if you care much for that approach,
> have a look at sysopen/sysread.
> 
> A better approach is to read a line at
> a time, and split it down into symbols.
> However, it's unlikely you actually need
> to do this in Perl.  This works:
> 
> my @chars = split //, $string;
> 
> The best approach, is to read fixed sized
> blocks with sysread and then split into
> symbols.
> 
> NB: I said you rarely need to split into
> symbols, why?  Because Perl has one of the
> most expressive regular expression engine
> in existance, that does almost all the text
> manipulation you could ever require.
> 
> If it's not text manip, I'd like to know
> what happens to these symbols :)
> 
> Take care,
> 
> Jonathan Paton
I want to translate text files on Russian koi-8r under Linux into
Microsoft Windows-1251 keytables. So why I need read ALL symbols (also
CR and LF). And, anymore, I want to change the lenght of the lines
during this recoding.
I am trying this:

$char=getc TXT;

-- 
-----------!
My blessing!
Ramis.     !
-----------!

http://www.samtan.fromru.com
mailto: samtan@fromru.com

0
Ramis
4/17/2002 5:37:48 PM
Reply:

Similar Artilces:

PDB Symbols/symbol server
Does it exists server where are symbols from official Mozilla builds? I'm interested in Thunderbird 2.0.0.18 win32 symbols. PM ...

ld.so.1: output_ubs_prepf: fatal: relocation error: file /sbcimp/run/pkgs/WMI/utopia/calc/ubs/sod/bin/output_ubs_prepf: symbol cs_ctx_global: referenced symbol not found
Any clue ? It looks like LD_LIBRARY_PATH is OK Regards, Eugene On Tue, 11 Aug 2009 12:35:47 -0700, Eugene wrote: > Any clue ? > It looks like LD_LIBRARY_PATH is OK If you're on solaris or linux, try ldd output_ubs_prepf to see which libraries are linked into the binary. Michael Hello, Is this an ESQL/C or ESQL/Cobol program? Regards, Neal > core> ldd -d output_ubs_prepf > libsybdb.so => /opt/sybase/OCS-12_5/lib/libsybdb.so > libct.so => /opt/sybase/OCS-12_5/lib/libct.so > libc.so.1 => /lib/l...

Symbol lookup error
I'm using Inline->bind to bind to a static lib which has a few dependencies so I am setting LIBS to a series of 3 -L/-l pairs. Inline is successfully binding to the library and I go to make the call to the library but I'm failing with a Symbol lookup error - undefined symbol: bash-3.2$ /usr/local/bin/perl raid2 -load DbgSh.h Calling bind with libs set to -L/view/yfang_fp1.0_yfang_May24/vob/9200_packetcore/packetcore/infra/sysmgr/ipmi -lwiipmi -L/view/yfang_fp1.0_yfang_May24/vob/9200_packetcore/packetcore/infra/lib/src -lwinfra -L/vob/9200/software/common/debugshell ...

No Symbol
How can I get data at relative point in Graph Object which no symbol at erery data point for display clear?because it having some series and a lot of points . ...

Symbol file could not be found.
Can anybody help me solve the following problem while installing Visual Web Developer Express Edition? Thanks in advance for your help. Grace. The installation terminated after the debugging tool (i.e., WinDbg) displayed the following: Microsoft (R) Windows Debugger  Version 6.6.0007.5Copyright (c) Microsoft Corporation. All rights reserved. *** wait with pending attachSymbol search path is: C:\WINDOWSExecutable search path is: C:\WINDOWS\SymbolsModLoad: 00400000 0046e000   C:\Documents and Settings\S\Local Settings\Temp\SIT39610.tmp\setup.exeModLoad: 77cc0000 7...

Go to symbol definition / show symbol references
 Hi, I have read that the following fact applies to VS 2005:F12 - Go to symbol definitionShift-F12 - Show all references to a symbol Is there something like in VS 2008 too (it doesnt work for me in VS 2008)?   They both work for me in VS 2008.C# <---> VB.Net Translator  Hmm, since it doesnt seem to work for me:can you tell me how I can set the shortcut for the above? Under Tools -> Options -> Keyboard is where you can set shortcuts.C# <---> VB.Net Translator...

RFC 326 (v1) Symbols, symbols everywhere
This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Symbols, symbols everywhere =head1 VERSION Maintainer: Paolo Molaro <lupus@debian.org> Date: 26 Sep 2000 Mailing List: perl6-internals@perl.org Number: 326 Version: 1 Status: Developing =head1 ABSTRACT Perl should adopt scheme-like symbols, both at the language level and at the internals level. =head1 DESCRIPTION Symbols can be useful in a variety of ways both at the language level and as an implementation detail for efficiency reasons. =head2 Symbols at ...

Symbols
How do I insert a symbol into an I7 report. By symbol I mean the symbol for micro (u). Select a text field, then write an "m" and finally change Font type to Symbol. <Barry_Knight> escribi� en el mensaje news:EBE92584A92F5F7D00135C2385256BAB.00135C3885256BAB@webforums... > How do I insert a symbol into an I7 report. > By symbol I mean the symbol for micro (u). ...

# symbol
I've inherited a whole project and am trying to decipher how it all fits together. Could someone please tell me what the pound symbol (#) means in the following 2 pieces of code? a) arr = split(aMaster(i),"#") b) iScore = request.form("iMEAN_#" & sSubScale_Short) Thanks it's being used as nothing more then a delimeter... same as a comma would, or | or whatever...just what they/he/she decided to use. The '#' character is obviously used as a delimiter in a string of values. This statement is actually converting the string into a string array. ...

Symbols
Good Morning. This may sound like a lame question. Is there anywhere that I can get a key of the various symbols that accompany emails? E.G. I know that a paper clip symbol represents an attachment. Thanks -- JebediahShapnacker ------------------------------------------------------------------------ Finally found it in help! Sorry for wasting your time! -- JebediahShapnacker ------------------------------------------------------------------------ JebediahShapnacker's Profile: http://forums.novell.com/member.php?userid=13749 View this thread: http://...

How to package symbol files
Following the instruction https://developer.mozilla.org/en/Building_Firefox_with_Debug_Symbols, we built xulrunner application with symbols. After the build is done, this command does not work make -C objdir buildsymbols I am getting error "No rule to make target buildsymbols" How can we properly package the symbol files for xulrunner application build? Would appreciate any help. -Beth On Thu, Apr 22, 2010 at 1:53 PM, Beth Chen <chenbeth@hotmail.com> wrote: > Following the instruction > https://developer.mozilla.org/en/Building_Firefox_wi...

No Symbol
I want to get data at every point in Graph Control ,but these points have no symbol(NoSymbol!).How can I get it to display with StaticText? ...

Symbols
Name: Mark Hall Email: altocarodrive1psatontdotcom Product: Thunderbird Summary: Symbols Comments: I just downloaded your new release. What are the new symbols, Left arrow, right arrow, and left&right arrow on the same e-mail. Something looked like a candle. Just wondering. Thanks Browser Details: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; FunWebProducts-MyWay; .NET CLR 1.0.3705; .NET CLR 1.1.4322; SpamBlockerUtility 4.6.1; InfoPath.1) ...

symbol server (symbols.m.o) moved
Hello, We're now hosting symbols in S3, and have just completed the transition of the Mozilla symbol server (http://symbols.mozilla.org) in bug 1097209. If you use this service and notice any problems, please file a bug in Socorro::Infra (or just let me know) Thanks! Rob Helmer ...

Web resources about - Read file symbol by symbol? - perl.beginners

Book:Typographical symbols - Wikipedia, the free encyclopedia
This is a Wikipedia book , a collection of Wikipedia articles that can be easily saved, rendered electronically, and ordered as a printed book. ...

Peace for Paris - the artist behind the symbol that's gone viral
... of murderous attacks in Paris at the weekend, French artist Jean Jullien had sketched out what has become known as the Peace for Paris symbol ...

Paris attacks: #PeaceForParis symbol goes viral following terrorist attacks
A Peace for Paris symbol, combining the Eiffel Tower with the '60s peace sign, goes viral following the Paris terror attacks.

It’s Laundry Day, but what do the symbols mean on the label?
There are probably some people out there who know exactly what the care symbols on clothing labels mean. But, there are many who do not and if ...

Amazon backtracks after covering NYC subway car in Nazi symbols
... version of the book, Amazon Studios perhaps took that premise a little too literally by filling a New York City subway car with Nazi symbols ...

What’s up with all the Nazi Germany symbols on a NYC train?
Decorating a New York subway car with symbols from the second World War might be one of the best ways to promote The Man in the High Castle , ...

Eiffel Tower Peace Symbol: The Least Appropriate Thing Ever
So what does France do? What does the American media do? Lionizes a symbol of weakness and surrender.

'Peace for Paris' symbol goes viral
Paris (AFP) - A "Peace for Paris" symbol, combining the city's beloved Eiffel Tower with the peace sign of the Sixties, has gone viral following ...

Twitter could move beyond its heart symbol to offer richer responses
A feature hidden in a developer version of Twitter's app shows emoji to express more emotions. That feature would add complexity to the service, ...

Ads with World War II symbols pulled after outcry in NY - CNN.com
New York subway ads promoting the Amazon streaming series "The Man in the High Castle" have been pulled after an outcry.

Resources last updated: 12/20/2015 6:12:27 PM